Computing.Net > Forums > Programming > Primary Key in MYSQL

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Primary Key in MYSQL

Reply to Message Icon

Name: Nirav
Date: October 30, 2002 at 07:21:32 Pacific
OS: win98
CPU/Ram: p3
Comment:

Hi:
im practicing MYSQL. i have a question regarding that. how can i assign primary key for 2 columns(composite primary key) with CREATE command. EX: EMP_ID,EMP_NAME, EMP_DOB,EMP_SAL; NOW I WANT TO MAKE EMP_ID & EMP_NAME AS COMPOSITE PRIMARY KEY. any help is greatly appreciated.
thank u
Nirav



Sponsored Link
Ads by Google

Response Number 1
Name: Don Arnett
Date: October 30, 2002 at 08:14:36 Pacific
Reply:

You can view the mysql manual online. Different viewing options are available at:
http://www.mysql.com/documentation/index.html

I downloaded the PDF file and have shortcut to it on my desktop.

The create page is at:
http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html#CREATE_TABLE


0

Response Number 2
Name: brandon
Date: November 1, 2002 at 09:31:18 Pacific
Reply:

I posted the answer to your last posting. Look there.

I might as well type it again. To create a concantenated Primary Key you type both fields inside parenthesis seaparated by a comma.

Example:
PRIMARY KEY (FIELD1, FIELD2)

If this is your last statement then you need to add the second closing parenthesis.

I'm actually using S\SQL in a mainframe environment, but this syntax should be the same on any system.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


importing table Java 2d Graphics



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Primary Key in MYSQL

Primary & Foreign Keys in MySQL www.computing.net/answers/programming/primary-amp-foreign-keys-in-mysql/14463.html

User already in the database www.computing.net/answers/programming/user-already-in-the-database/11061.html

binding a key in windows xp www.computing.net/answers/programming/binding-a-key-in-windows-xp/10760.html