Welcome to plsql4all.blogspot.com SQL, MYSQL, ORACLE, TERADATA, MONGODB, MARIADB, GREENPLUM, DB2, POSTGRESQL.

Saturday, 23 August 2014

Primary Key Constraint in MySql

We can create Primary Key constraint in MySql with the help of follwoing syntax:-

create table table_name
(
column_name data_type,
column_name data_type,
....
PRIMARY KEY (COLUMN_NAME)
);

Below is the example:-

CREATE TABLE EMPLOYEE
(
EMP_ID INT,
EMP_NAME VARCHAR(20),
EMP_ADR VARCHAR(20),
PRIMARY KEY(EMP_ID) 
);




No comments:

Post a Comment

Please provide your feedback in the comments section above. Please don't forget to follow.