Rainbow Deals - hours only!Up to 80% off on all courses and bundles.-Close
Inserting data
1. Insert data

## Instruction

Alright, we'll start off with inserting data into our database. To add data into a table, you use the INSERT command. Let's add a 9-year-old Alice as a user with id 5:

INSERT INTO user VALUES (5, 'Alice', 9);

See what happened? After INSERT INTO, we put the name of the table (user) which we're adding information to. Next, we add the keyword VALUES followed by the actual values (5, 'Alice', 9) for each column of the table. As you can see, the values must be surrounded by parentheses and values are separated with commas.

The first number is the value for the column id. The column id is a numeric column, so we just type the number.

The text 'Alice' is the value for the second column, name. It is a text column, it contains short text information. In SQL you surround text information with single quotes ('example').

The number 9 is the value for the third column, age. It is a numeric column, just like id, so we just type the number.

Remember, in this case you need to put the values in the exactly same order in which the columns appear in the database.

## Exercise

The restaurant owners decided to introduce some Balkan cuisine, so we need to refresh the menu a little bit.

Add a dish called Cevapcici with id 9 and price 27. It's a main course.

### Stuck? Here's a hint!

Type

INSERT INTO dish
VALUES (9, 'main course', 'Cevapcici', 27);