INSERT Statements

INSERT statements are used to insert new data into a table.

An INSERT statement will have 2 or 3 main parts

  1. Specify the table that the new record will be inserted into

  2. Specify the fields you are inserting data for (optional)

  3. List the values you are inserting

Inserting a value for every field

If you are inserting a value for every single field then we will just specify the table we are inserting into and the values that we are inserting.

A new instructor joins and his details need to be added. His ID is 5 and his name is D Thomas, he was born on the 1/5/86 and is a Grade 5.

INSERT Query Design

SQL Statement Example

The order of fields have to be the same order they were created in.

Update Query - Inserting a value for certain fields

If you are only inserting a value for some fields then we will also need to specify the fields that we are inserting values for.

The organisation is running a new BMX Advanced Course, its course ID is BMX05 and will be a BMX Advanced, it will run for 4 days and can take 10 people. It will be ran by Instructor R Hay ( ID 3) and will cost £400. They haven’t decided a date or price yet.

INSERT Query Design

SQL Statement Example

SQL Tutorial 3 INSERT Statements

4 INSERT Statements.mp4

This video will cover how to INSERT data into a table