The INSERT command is used to add a new row to a table.
INSERT INTO games(yr, city) VALUES (2012,'London')
The table is
The column names are
Strings in the literal values must be quoted with single quotes.
|yr ||city |
|2000 ||Sydney |
|2004 ||Athens |
|2008 ||Beijing |
games shows the year and the city hosting
the Olympic Games.
You want to add the next Olympic games, in the year 2012, which will be held in London.
The INSERT statement adds a new row to the table:
What can go wrong
Your INSERT statement may break some database rule such as the unique key requirement.
In this example there is a primary key on year - that means that there may not be two rows with the
same year. If you attempt to add a second row with 2008 for yr then you will get an error.