2.4: Insert

For this challenge, you'll write a query that includes several different SQL statements to insert data into your table. This is sometimes referred to as "seeding" your table with data. Try experimenting with different syntax for the exercises in this challenge.

Write a query that inserts multiple products into the table. The resulting table should include the information listed below:

  • Write one statement that uses standard syntax to insert a product.

  • Write one statement that has a different order of columns for the insert. In other words, you should not enter the data so that "ProductID" is first, "ProductName" is second, "Price" is third, and "ProductDescription" is last.

  • Write one statement that skips using the column list, but keeps the values in order.

  • Write a statement that adds multiple items to the table at one time.

  • Write a statement that skips adding data in one of the nullable columns.

Follow the steps below to view your table in pgAdmin 1. Click on the plus sign next to "SQL_Library" to expand the menu. 2. Click on "Schemas" in this new menu; it should be the last item in the list. 3. Click on the plus sign next to "public" to expand the menu. 4. Click on "Tables" in this new menu. There should be a (1) next to it to indicate that there is one table. If there is no plus sign or you don't see a (1) next to "Tables," right click on "Tables," and a menu should pop up. Click on "Refresh" in that menu. 5. Now you should see your "products" table. Right click on it. 6. A new menu will pop up. Hover over "View/Edit Data," and then click on "All Rows." This should bring up a view of your table in the bottom half of the screen.

You can see the navigation path in the screenshot below.

To see the solution for this challenge, click on 2.12 Solutions. Then, continue to Part 2.5: Update.

Last updated