Insert Product Data
Revise the insert command to store data in the products table.
Insert data
Now that the table is ready, let’s insert a new product:
Press + to interact
insert into products(name, price) values ('Game of Thrones-S01-DVD', 50.0);
In the insert
statement above, we first specify the columns we’ll give values for. Then, we provide the values themselves and get a Succeeded
response because there’s nothing to display.
Let’s double-check that the product has been created:
Press + to interact
select * from products;
When we run the code above, we get the following output:
+----+-----------------------------+-------+
| id | name
...Create a free account to view this lesson.
By signing up, you agree to Educative's Terms of Service and Privacy Policy