Create Primary Key in Sql table
How To create primary key in sql table :
You have a code(for table)like this:
create table person( name varchar2(5),
Id_no number(3),
Address number(10));
Now you want to make Id_no as Primary key: so there are two methods to make a column primary key one in table order and other one is column order.
===================================================
Column Order:
create table person( name varchar2(5),
Id_no number(3) primary key,
Address number(10));
==================================================
Table Order:
create table person( name varchar2(5),
Id_no number(3),
Address number(10),
primary key(Id_no));
You have a code(for table)like this:
create table person( name varchar2(5),
Id_no number(3),
Address number(10));
Now you want to make Id_no as Primary key: so there are two methods to make a column primary key one in table order and other one is column order.
===================================================
Column Order:
create table person( name varchar2(5),
Id_no number(3) primary key,
Address number(10));
==================================================
Table Order:
create table person( name varchar2(5),
Id_no number(3),
Address number(10),
primary key(Id_no));
Post a Comment