Insert Product Data
Revise the insert command to store data in the products table.
We'll cover the following...
We'll cover the following...
Insert data
Now that the table is ready, let’s insert a new product:
Press + to interact
MySQL
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
MySQL
select * from products;
When we run the code above, we get the following output:
+----+-----------------------------+-------+
| id | name | price |
+----+-----------------------------+------
...