The INSERT statement is used to insert records in a table. The table selected to insert data must have the same number of columns and values. In this tutorial section, we will discuss on the Insert statement syntax with an example.
Once the table is created, the next step is to insert values into it according to its constraints. The insert statement consists of two ways.
We are using the only values method in this tutorial section. In only values, the values entered must be in an order according to the column.
INSERT INTO tablename VALUES (value1, value2,….valueN);
where INSERT INTO and VALUES are the keywords and tablename is the name of the table; value1 to valueN are the set of values, followed by a semicolon.
Values are given for each of the columns, respectively. Whenever a variable length character appears, then the values are entered in a single quote. And when an integer appears, it is written just like that.
Finally, our table is ready with the values. We have inserted six records and, this is the way Insert query in SQL works. In the next tutorial section, we will learn how to select individual records from a table.
Download Interview Questions asked by top MNCs in 2019?