473,395 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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 12050
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
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
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
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
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
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
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
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
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
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.