No particular DBMS in mind, how would I do the following:
# There are many tables per one restaurant, many napkins per one table
# Pseudo SQL
SELECT RESTAURANT WHERE ID = X;
SELECT ALL TABLES WHERE RESTAURANT_ID = RESTAURANT.ID;
SELECT ALL NAPKINS WHERE TABLE_ID = TABLE.ID;
But, all in one query? I’ve used a JOIN to get all the tables in the same query as restaurant, but is it possible to get all napkins for each table as well, in the same query?
1 Answer