Go to: Articles List

SQL Basics Part 3 : Insert Statement

Now that you know how to select records out of a database, you should also know how to insert records in to one. The insert statement is used like this:

INSERT INTO TableName (Column1, Column2, Column3)
VALUES ('Value1','Value2','Value3')

Tablename is the name of the table you want to insert in to. Column1, 2, etc. are the names of the columns that you want to insert the corresponding values (value1, 2, 3, etc.) in to. Here is an example:

INSERT INTO CustomerTable (fname, lname, gender) VALUES ('John','Doe','m')

The above code would insert one record with the VALUES information in to CustomerTable at the corresponding columns.