473,503 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Mysql primary, foriegn and composite keys

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
3 12059
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
632
by: Girish Agarwal | last post by:
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 ...
0
2620
by: Girish Agarwal | last post by:
--0-474210375-1058976151=:31789 Content-Type: text/plain; charset=us-ascii Content-Id: Content-Disposition: inline Note: forwarded message attached. __________________________________
5
6893
by: John | last post by:
Specifically for joint tables... tblStudents tblClasses tblClasses_Students Is it be good programming to use a composite primary key in tblClasses_Students (where the key is ClassID and...
18
12621
by: Thomas A. Anderson | last post by:
I am a bit confused in creating a composite primary key. I have three table with two of the tables containing primary keys. I have two of the tables (each with a primary key) having one to many...
7
2449
by: Dave | last post by:
Hi, Maybe I'm missing something with the DataKeyField attribute of a datagrid but it seems that it's somewhat limiting since this only allows you to specify one field as the key. I have a...
6
5403
by: mac | last post by:
Summary: 1. I want to define a column in anMS Access table to be lookups on other tables. 2. The table that is the data source (e.g the "parent" table) has a composite primary key. 3. When...
7
5597
by: Ronald S. Cook | last post by:
My client manager likes concatenated/composite primary keys. I don't. Can anyone forward any arguments pro or con? Thanks, Ron
4
3813
by: Peter | last post by:
I am interested in informed feedback on the use of Constraints, Primary Keys and Unique. The following SQL statement creates a Bands tables for a database of bookings Bands into Venues, where the...
4
2958
by: Wolfgang Keller | last post by:
Hello, so far it seems to me as if the only ORM module for Python which supports composite primary/foreign keys was SQLAlchemy. Which looks a little bit "overbloated" for my needs: I "just" need...
0
7287
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7348
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7467
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5592
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4685
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1519
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
397
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.