-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Page 46 eBook
PostPosted: Thu Nov 30, 2006 10:29 am 
Newbie

Joined: Wed Nov 30, 2005 4:40 pm
Posts: 14
Location: St. Louis MO.
Shouldn't foreign key reference users?

create table USERS (
USERNAME varchar(15) not null primary key,
NAME varchar(50) not null,
ADDRESS varchar(100)
)
create table BILLING_DETAILS (
ACCOUNT_NUMBER varchar(10) not null primary key,
ACCOUNT_NAME varchar(50) not null,
ACCOUNT_TYPE varchar(2) not null,
USERNAME varchar(15) foreign key references user
)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 30, 2006 10:48 am 
Beginner
Beginner

Joined: Tue Nov 21, 2006 5:18 am
Posts: 31
Location: Bangalore, India
Hi,

You can do like this,

create table USERS (
USERNAME varchar(15) not null primary key,
NAME varchar(50) not null,
ADDRESS varchar(100)
)
create table BILLING_DETAILS (
ACCOUNT_NUMBER varchar(10) not null primary key,
ACCOUNT_NAME varchar(50) not null,
ACCOUNT_TYPE varchar(2) not null,
USERNAME varchar(15)
)

after creating do alter table

alter table BILLING_DETAILS add constraint USERNAME_FK foreign key(USERNAME) references USERS

_________________
persist_coder
--credit please if it helps you


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 30, 2006 10:52 am 
Newbie

Joined: Wed Nov 30, 2005 4:40 pm
Posts: 14
Location: St. Louis MO.
Thanks bra!


This typo appears again on Page 50 of the eBook


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 30, 2006 10:58 am 
Beginner
Beginner

Joined: Tue Nov 21, 2006 5:18 am
Posts: 31
Location: Bangalore, India
does it helps you, then please credit

_________________
persist_coder
--credit please if it helps you


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.