The INSERT statement in SQL is used to add new records (or rows) into a database table. You can insert values into all columns of the table, or just into specific columns.
Here is the basic syntax for using the INSERT statement:
INSERT INTO table_name (column1, column2, column3, ...)
VALUES (value1, value2, value3, ...);Where:
Consider a table named Students with the following columns: ID, Name, and Age. Here's how you would insert a new record into this table:
INSERT INTO Students (ID, Name, Age)
VALUES (1, 'Shaikh Arshiya Naaz', 25);This command inserts a new row into the Students table where the ID is 1, the Name is 'John Doe', and the Age is 22.
You can insert multiple rows at once by providing multiple sets of values, separated by commas:
INSERT INTO Students (ID, Name, Age)
VALUES 
(2, 'Syeda Anam Fatema ', 23),
(3, 'Khan Shaista', 23);This statement inserts two rows into the Students table.
If you only want to insert values into specific columns of a table, you can omit the others. For example:
INSERT INTO Students (Name, Age)
VALUES ('Khan Noorain', 23);In this case, the ID column would either use its default value or auto-increment (if defined as such in the table schema).
SQL INSERT is used across most relational database systems, including: