By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,212 Members | 1,076 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,212 IT Pros & Developers. It's quick & easy.

Mysql primary, foriegn and composite keys

P: n/a
Hi All,
I have a database consisting of 2 tables.
patient_info ( Patient Information ).Looks like
lastname VARCHAR(10)
fname VARCHAR(10)
ssno INT(9) PRIMARY KEY
ID INT(4) AUTO_INCREMENT

patientins_info ( PatientInsurance Information)

insco VARCHAR(10)
insid VARCHAR(10)

I want to create chart number based on :-
2 characters of (lastname)+2characters of
(fname)+(ID)
( So according to my understanding I will have to
generate some kind of composite key ).

Also, this chart number will be my primary key in
all
patient insurance database. Since I am fairly new in
database area, I don't know much but I think I will
have to define some kind of references/foriegn key
relations. My database type is MyISAM.

Please advise.

Thanks,
Girish

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/my***********...ie.nctu.edu.tw

Jul 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
r
foreign keys are only going to work with Innodb tables
"Girish Agarwal" <gi*******@yahoo.com> wrote in message
news:bf***********@FreeBSD.csie.NCTU.edu.tw...
Hi All,
I have a database consisting of 2 tables.
patient_info ( Patient Information ).Looks like
lastname VARCHAR(10)
fname VARCHAR(10)
ssno INT(9) PRIMARY KEY
ID INT(4) AUTO_INCREMENT

patientins_info ( PatientInsurance Information)

insco VARCHAR(10)
insid VARCHAR(10)

I want to create chart number based on :-
2 characters of (lastname)+2characters of
(fname)+(ID)
( So according to my understanding I will have to
generate some kind of composite key ).

Also, this chart number will be my primary key in
all
patient insurance database. Since I am fairly new in
database area, I don't know much but I think I will
have to define some kind of references/foriegn key
relations. My database type is MyISAM.

Please advise.

Thanks,
Girish

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/my***********...ie.nctu.edu.tw

Jul 19 '05 #2

P: n/a
r
foreign keys are only going to work with Innodb tables
"Girish Agarwal" <gi*******@yahoo.com> wrote in message
news:bf***********@FreeBSD.csie.NCTU.edu.tw...
Hi All,
I have a database consisting of 2 tables.
patient_info ( Patient Information ).Looks like
lastname VARCHAR(10)
fname VARCHAR(10)
ssno INT(9) PRIMARY KEY
ID INT(4) AUTO_INCREMENT

patientins_info ( PatientInsurance Information)

insco VARCHAR(10)
insid VARCHAR(10)

I want to create chart number based on :-
2 characters of (lastname)+2characters of
(fname)+(ID)
( So according to my understanding I will have to
generate some kind of composite key ).

Also, this chart number will be my primary key in
all
patient insurance database. Since I am fairly new in
database area, I don't know much but I think I will
have to define some kind of references/foriegn key
relations. My database type is MyISAM.

Please advise.

Thanks,
Girish

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/my***********...ie.nctu.edu.tw

Jul 19 '05 #3

P: n/a
r
foreign keys are only going to work with Innodb tables
"Girish Agarwal" <gi*******@yahoo.com> wrote in message
news:bf***********@FreeBSD.csie.NCTU.edu.tw...
Hi All,
I have a database consisting of 2 tables.
patient_info ( Patient Information ).Looks like
lastname VARCHAR(10)
fname VARCHAR(10)
ssno INT(9) PRIMARY KEY
ID INT(4) AUTO_INCREMENT

patientins_info ( PatientInsurance Information)

insco VARCHAR(10)
insid VARCHAR(10)

I want to create chart number based on :-
2 characters of (lastname)+2characters of
(fname)+(ID)
( So according to my understanding I will have to
generate some kind of composite key ).

Also, this chart number will be my primary key in
all
patient insurance database. Since I am fairly new in
database area, I don't know much but I think I will
have to define some kind of references/foriegn key
relations. My database type is MyISAM.

Please advise.

Thanks,
Girish

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/my***********...ie.nctu.edu.tw

Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.