We’ll be progressing from simply selecting records from a database to actually changing the data that resides in it. In this installment, we’ll add data with SQL’s insert statement.
The insert statement is a very straightforward one, and you’ll be surprised on how easy it is to add records to a database. Here is a simplistic example of what the code looks like:
INSERT INTO table_name (column_name1, column_name2, column_name3, column_name4) VALUES ('value_1','value_2','value_3','value_4')
The first of the two lines needed begins with the insert into clause, proceeded by the name of the table, then in parenthesis all the columns you wish to insert data into. The second line starts with the term value followed by the individual records that are to be inserted into the table. The specific records are enclosed in single quotation marks, separated by commas, and the entire group lays inside parenthesis…