SQLite – CREATE TABLE Statement




SQLite – CREATE TABLE Statement

SQLite – CREATE TABLE Statement

In SQLite the CREATE TABLE Statement can be used to create table in a database.

A database in SQLite can contain one or more tables. The table conatins one or more rows as well as one or more columns.

Each table in SQLite must have a name.

SQLite CREATE TABLE Syntex

The syntex for creating a new table in a database using SQLite is show below:


Example:

So let’s consider we have created SCHOOL database. Now we want to create a STUDENTS table in this database.

In the Example above we created a STUDENTS table with five columns (ID, NAME, SURNAME, AGE, ADDRESS). The table STUDENTS have ID column as primary key and NOT NULL. These are the constrains to the field ID so that field ID can not be NULL while creating records.

Now Lets say we want to create one more table in SCHOOL database. This time we will create a table called TEACHERS.


.tables command

Above we have created two tables in the database. .tables command can be used to list down all the tables in the database.

.schema command

.schema command can be used to view the complete information or the table.



Partner Sites

VideoToGifs.com

EasyOnlineConverter.com

SqliteTutorials.com


  • syam sundar

    i would like to create a database with around 1500 tables with different table name 6 columns and data type same in each table , i have a data in excel sheet ..i need to upload in that table ..i dont know how to do ? can u help me to do