SQLite Create Table

SQLite Create Table To create a new table, the CREATE TABLE statement is used in SQLite.

Syntax:

CREATE TABLE database_name.table_name(  
   column_1 datatype  PRIMARY KEY(one or more columns),  
   column_2 datatype,  
   column_3 datatype,  
   .....  
   column_N datatype,  
);  

Example:

CREATE TABLE TEACHERS(  
   ID INT PRIMARY KEY NOT NULL,  
   NAME TEXT NOT NULL,  
   SUBJECT TEXT NOT NULL, 
);

Explanation: In the above example, we created a table named “TEACHERS” with three columns ID, NAME and SUBJECT, each having their own particular data type and column constraint. To check all the existing table in the database, use the command “.tables”.

Please follow and like us:
Content Protection by DMCA.com