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:
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:
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:
Second Method:
You can also insert the data into the table by second method.
Output:
You can see the output by using the SELECT statement:
No comments:
Post a Comment