Insert data in table using SQL

Insert SQL statement is very important. We can also say that, this is the initial step where we insert new data into the tables in DML (data manipulation language). In this tutorial we will define insert statement with two variations. In first insert statement we will explain how we can insert data with selected columns or with partial columns only. In second statement we will insert data in table with all the columns. 1. In first type of insert statement, we need specify both column names and respective values, to be inserted. Here we can make our insert query with selective columns, we do not need to specify all the columns and their values. Example


INSERT INTO student_info (first_name, last_name) VALUES ('Raj', 'Kumar'); 
2. In second type of insert statement, we need specify only values to be inserted, we do not need to include column names. Here we need to specify all the values for all the columns present in the table mandatorily.

Example


INSERT INTO student_info VALUES (1, 'Raj', 'Kumar', '2015', '3rd');