Wednesday, 23 May 2012
 Home arrow Blog arrow Create a MySQL table with a primary key
   
Main Menu
Home
News
Blog
Links
Search
FAQs
Spider
Articles
@intrenet
Free Softwares
Break for fun
Friends VIdeos
Techno videos
Contact Us
Disclaimer
Guest Book
Speed test
V.E.C. Calculator
IPv4 Subnet Calc
IPv6 Subnet Calc
Byte Converter
Converter
GMT/UTC Time
Bandwidth Calc
Allinone Calc
IANA Port Numbers
Country Call Codes
Pk Postal Codes
Surf Anonumously
Visitors Counter
mod_vvisit_countermod_vvisit_countermod_vvisit_countermod_vvisit_countermod_vvisit_countermod_vvisit_countermod_vvisit_counter
mod_vvisit_counterToday197
mod_vvisit_counterYesterday260
mod_vvisit_counterThis week457
mod_vvisit_counterThis month5006
mod_vvisit_counterAll125682
 
 
 
 


Create a MySQL table with a primary key PDF Print E-mail
User Rating: / 0
PoorBest 
Written by Amanatullah khalil   
Sunday, 24 May 2009

Create a MySQL table with a primary key

 

A primary key uniquely identify a row in a table. One or more columns may be identified as the primary key. The values in a single column used as the primary key must be unique (like a person’s social security number). When more than one column is used, the combination of column values must be unique.


When creating the contacts table described in Create a basic MySQL table, the column contact_id can be made a primary key using PRIMARY KEY(contact_id) as with the following SQL command:

CREATE TABLE `test1` (
contact_id INT(10),
name VARCHAR(40),
birthdate DATE,
PRIMARY KEY (contact_id)
);

Additional columns can be identified as part of the primary key with a comma separated list in the PRIMARY KEY command, like PRIMARY KEY (contact_id, name).

courtesy http://www.tech-recipes.com/rx/377/create-a-mysql-table-with-a-primary-key/

 
< Prev   Next >
 
 
 
csatpk Newsflash
Statistics
OS: Linux h
PHP: 5.2.17
MySQL: 5.1.63-community-log
Time: 03:41
Caching: Disabled
GZIP: Disabled
Members: 3
News: 368
Web Links: 5
Visitors: 266016
Popular