Hi All

I am trying to create 2 tables

Table 1 with cust_id , username and password (Cust_id is primary key here)

Table 2 wth cust_info that will store info for that cust........now i want to use this Cust_id as foreign key here in table2 but i am not able to do this

create table tbcustinfo (fname varchar(20),lname varchar(20),mobnum int,address varchar(40),city varchar(10),cust_id INT Not null,FOREIGN KEY(cust_id) RE
FRENCE tblogin(cust_id));


Can you please help me to create this


Thanks

Sumeeet Taneja

Recommended Answers

All 2 Replies

create table tbcustinfo (
fname varchar(20),
lname varchar(20),
mobnum int,
address varchar(40),
city varchar(10),
cust_id INT Not null,
CONSTRAINT fk_cust_id
FOREIGN KEY(cust_id)
REFRENCE tblogin(cust_id));

commented: You know your stuff +4
commented: Good one +11

Thanks a lot buddy,....it worked for me

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.