Interview Query

Generate Shopping List from Recipes

Start Timer

0:00:00

Upvote
11
Downvote
Save question
Mark as completed
View comments (14)
Next question

You are a chef preparing for an important event. You downloaded three recipes to make and imported each as a separate table: recipe1, recipe2, recipe3 into your database. Each recipe requires some grocery items in various quantities.

Write a query that sums up the total mass of each grocery item required across all recipes.

Input:

recipe1 table:

Column Type
grocery VARCHAR
mass INTEGER

recipe2 table:

Column Type
grocery VARCHAR
mass INTEGER

recipe3 table:

Column Type
grocery VARCHAR
mass INTEGER

Output:

Column Type
grocery VARCHAR
total_mass INTEGER
.
.
.
.
.


Comments

Loading comments