Task - Using INSERT
In the last task, we created a table that stores the products of a grocery store. They contact you again to fix the previous table making sure that the id
of each item in the products table is unique. They also want you to insert the following data into the table:
object[,] groceryItemsData = new object[,]
{
{ "Bananas", "Fruits", 0.99f, 150 },
{ "Apples", "Fruits", 1.49f, 100 },
{ "Carrots", "Vegetables", 0.79f, 200 },
{ "Potatoes", "Vegetables", 1.29f, 180 },
{ "Milk", "Dairy", 2.49f, 80 },
{ "Eggs", "Dairy", 1.99f, 120 },
{ "Bread", "Bakery", 1.99f, 90 },
{ "Chicken", "Meat", 4.99f, 50 },
{ "Rice", "Grains", 3.99f, 120 },
{ "Pasta", "Grains", 1.49f, 150 }
};
Your task is to:
- Create a new table called
store
and, this time, make theid
column a primary key and set it to automatically increment; - Insert the data given in the
groceryItemsData
array into the new table.
Everything was clear?
Thanks for your feedback!
SectionΒ 4. ChapterΒ 6
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Awesome!
Completion rate improved to 2.22
Task - Using INSERT
Swipe to show menu
In the last task, we created a table that stores the products of a grocery store. They contact you again to fix the previous table making sure that the id
of each item in the products table is unique. They also want you to insert the following data into the table:
object[,] groceryItemsData = new object[,]
{
{ "Bananas", "Fruits", 0.99f, 150 },
{ "Apples", "Fruits", 1.49f, 100 },
{ "Carrots", "Vegetables", 0.79f, 200 },
{ "Potatoes", "Vegetables", 1.29f, 180 },
{ "Milk", "Dairy", 2.49f, 80 },
{ "Eggs", "Dairy", 1.99f, 120 },
{ "Bread", "Bakery", 1.99f, 90 },
{ "Chicken", "Meat", 4.99f, 50 },
{ "Rice", "Grains", 3.99f, 120 },
{ "Pasta", "Grains", 1.49f, 150 }
};
Your task is to:
- Create a new table called
store
and, this time, make theid
column a primary key and set it to automatically increment; - Insert the data given in the
groceryItemsData
array into the new table.
Everything was clear?
Thanks for your feedback!
SectionΒ 4. ChapterΒ 6