Knowledge Walls
Gopal Rao
Mumbai, Maharashtra, India
Passcode:
How to create primary key to column in SQL
2414 Views
Syntax
columnName dataType primary key
Example
CREATE TABLE Department
(Dept_no varchar(5) primary key,
Dept_name varchar(20),
location varchar(20));
Hints 
Primary key is like a id(unique).if you insert the same values in the primary key column it wont allow the values inside the column.While run the query it shows some error.Different types of keys available for different purpose.Some of the keys names are foreign key,super key,unique key etc.,

NOTE: When you are creating the table give like this.
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details