Inserting Hierarchical Rows

In Inserting Hierarchical Rows, how we can find out which two tables are connected to each other or multiple table. How to find out which table is parent table and which is children table? :face_with_monocle:

The child table has a foreign key referencing the parent table.
foreignkeys

You’ll learn about foreign keys in the Designing Databases section.

1 Like

Hi, I have just completed the section on Inserting Hierarchical Rows.

In the section below are we changing the value of the price of the item by inserting them with a price here? I mean aren’t the item prices for the items in sql_store.products already?

Thanks
Vivian

One might think it’s redundant to have a unit_price both in products and order_items. But in case the price in products changes you still want to continue processing orders with the price that was valid by the time they were placed.

1 Like