Insert syntax introduction

Insert command is used to insert data into a table. There are three basic syntax options how to write these queries. 

The first statement that I will show is the one I started using when I first learned sql: 

insert into tablename values (0,'string1',1);

As you may notice, there are no column names stated in the query. All you have to do is fill in the values (the string values must be enclosed in quotes). Looks beautiful, but while I was using it I came to realise that it is rather a bat habit. It imples you know the order and data types of the columns. And after some time you will not remember any more.

 

That's where I started using this syntax:

insert into tablename set col1=0, col2='string1', col3=1;

 

The last one is to separate the columns and their corresponding values in the exact order in the query: 

insert into tablename (col1,col2,col3) values (0,'string1',1)