TheDeveloperBlog.com

Home | Contact Us

C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML

SQLite Insert Query

SQLite Insert Query with history, features, advantages, installation, commands, syntax, datatypes, operators, expressions, databases, table, crud operations, clauses, like, glob, limit, and clause, advance sqlite

<< Back to SQLITE

SQLite Insert Query

In SQLite, INSERT INTO statement is used to add new rows of data into a table. After creating the table, this command is used to insert data into the table.

There are two types of basic syntaxes for INSERT INTO statement:

Syntax1:

INSERT INTO TABLE_NAME [(column1, column2, column3,...columnN)]  
VALUES (value1, value2, value3,...valueN); 

Here, column1, column2, column3,...columnN specifies the name of the columns in the table into which you have to insert data.

You don't need to specify the columns name in the SQlite query if you are adding values to all the columns in the table. But you should make sure that the order of the values is in the same order of the columns in the table.

Then the syntax will be like this:

Syntax2:

INSERT INTO TABLE_NAME VALUES (value1,value2,value3,...valueN); 

Let's take an example to demonstrate the INSERT query in SQLite database.

We have already created a table named "STUDENT". Now enter some records in that table.

Inserting values by first method:

INSERT INTO STUDENT (ID,NAME,AGE,ADDRESS,FEES)
VALUES (1, 'Ajeet', 27, 'Delhi', 20000.00);
INSERT INTO STUDENT (ID,NAME,AGE,ADDRESS,FEES)
VALUES (2, 'Akash', 25, 'Patna', 15000.00 );
INSERT INTO STUDENT (ID,NAME,AGE,ADDRESS,FEES)
VALUES (3, 'Mark', 23, 'USA', 2000.00 );
INSERT INTO STUDENT (ID,NAME,AGE,ADDRESS,FEES)
VALUES (4, 'Chandan', 25, 'Banglore', 65000.00 );
INSERT INTO STUDENT (ID,NAME,AGE,ADDRESS,FEES)
VALUES (5, 'Kunwar', 26, 'Agra', 25000.00 );
SQLite Insert query 1

Second Method:

You can also insert the data into the table by second method.

INSERT INTO STUDENT VALUES (6, 'Kanchan', 21, 'Meerut', 10000.00 );
SQLite Insert query 2

Output:

You can see the output by using the SELECT statement:

SELECT * FROM STUDENT;
SQLite Insert query 3




Related Links:


Related Links

Adjectives Ado Ai Android Angular Antonyms Apache Articles Asp Autocad Automata Aws Azure Basic Binary Bitcoin Blockchain C Cassandra Change Coa Computer Control Cpp Create Creating C-Sharp Cyber Daa Data Dbms Deletion Devops Difference Discrete Es6 Ethical Examples Features Firebase Flutter Fs Git Go Hbase History Hive Hiveql How Html Idioms Insertion Installing Ios Java Joomla Js Kafka Kali Laravel Logical Machine Matlab Matrix Mongodb Mysql One Opencv Oracle Ordering Os Pandas Php Pig Pl Postgresql Powershell Prepositions Program Python React Ruby Scala Selecting Selenium Sentence Seo Sharepoint Software Spellings Spotting Spring Sql Sqlite Sqoop Svn Swift Synonyms Talend Testng Types Uml Unity Vbnet Verbal Webdriver What Wpf