CREATE TABLE with SQL Command with PRIMARY KEY and FOREIGN KEY

 If we want to create table named "personal" with PRIMARY KEY and FOREIGN KEY then we can use below shown sql query :

CREATE TABLE personal(

id INT NOT NULL,

 name VARCHAR(50) NOT NULL,

 percentage INT NOT NULL,

 age INT NOT NULL,

 gender VARCHAR(1) NOT NULL,

 city INT NOT NULL,

 PRIMARY KEY(id),

 FOREIGN KEY(city) REFERENCES city(cid)

);

Comments

Popular posts from this blog

Logical_Operators

Get Functions

print_Statement