SQL CREATE TABLE


SQL CREATE TABLE:
This statement is used to create table in a database.

Syntax:
create table "tablename"  
("column1" "data type",  
"column2" "data type",  
"column3" "data type",  
...  

"columnN" "data type");  



Let us take an example to create a EMPLOYEE table with ID as primary key and NOT NULL are the constraint showing that these fields cannot be NULL while creating records in the table.

EX:


SQL> CREATE TABLE Employee (  
ID INT                                       //NOT NULL,  
NAME VARCHAR (20)             //NOT NULL,  
AGE INT                                   // NOT NULL,  
ADDRESS CHAR (25),  
PRIMARY KEY (ID)  
);  




You can check it, on the off chance that you have made the table effectively by taking a gander at the message showed by the SQL Server, else you can utilise DESC order as takes after: 

SQL> DESC  EMPLOYEE;

Comments

Popular posts from this blog

Difference between DROP,TRUNCATE and DELETE