SQL explained: What is SQL | Select Statement | Select Where | Insert | Update/Edit | Delete | Order By | Select Between

SQL Insert Statement

The SQL Insert statement is simply used to insert data (add rows) into a database.

Syntax: INSERT INTO TableName (Column1,Column2) VALUES ('Value1','Value2')

TableName is the name of the table you want to insert the data into. Column1 and Column 2 are the names of the Columns you want to put that data into and Value1 and Value2 are the corresponding values you want to insert.

Let's use a table called 'Members_tbl' that holds 2 records as shown in Diagram 1.

Diagram 1
SQL Insert

To add a third record we could use the highlighted SQL insert statement below.

INSERT INTO Members_tbl (FirstName,LastName,Address,City) VALUES ('Henry','Cole','123 Smut Road','Dublin')

Diagram 2 illustrates what our revised table will look like after the SQL statement has been run.

Diagram 2
SQL Insert statement

Get the best asp hosting provider from web-hosting-top.com and save up to 30%

Advertisements



MembersPro

MembersPro PayPal - ASP Membership software

Plug and play ASP membership script that integrates with PayPal to let you charge recurring membership fees.

Global ASP.NET Hosting Leader - Click Here