C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
SQLite Create TableIn SQLite, CREATE TABLE statement is used to create a new table. While creating the table, we name that table and define its column and data types of each column. Syntax: CREATE TABLE database_name.table_name( column1 datatype PRIMARY KEY(one or more columns), column2 datatype, column3 datatype, ..... columnN datatype, ); Let's take an example to create table in SQLite database: CREATE TABLE STUDENT( ID INT PRIMARY KEY NOT NULL, NAME TEXT NOT NULL, AGE INT NOT NULL, ADDRESS CHAR(50), FEES REAL ); ![]() Use the SQLite ".tables" command to see if your table has been created successfully. .tables ![]() Let's create another table DEPERTMENT for future operations. CREATE TABLE DEPARTMENT( ID INT PRIMARY KEY NOT NULL, DEPT CHAR(50) NOT NULL, EMP_ID INT NOT NULL ); Now, we have two tables "DEPARTMENT" and "STUDENT". ![]() Now check the created tables: ![]()
Next TopicSQLite Drop Table
|