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)
);
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)
);
Read also:- Constraint in Oracle