XML vs. SQL Bake-off: Analyzing Recipes with JSON Data, Study notes of Introduction to Database Management Systems

In this document, students participate in a competition where they must decide whether to convert a json data set into xml or sql format to answer a series of queries related to recipes. The data set includes information about recipe titles, ingredients, and food categories. Students are provided with starter code and queries to help them complete the task. The goal is to find information such as the titles of breakfast recipes, the number of recipes with more than 5 ingredients, the average number of ingredients required for a recipe, and more.

Typology: Study notes

2011/2012

Uploaded on 07/15/2012

sajja
sajja 🇮🇳

28 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
XML vs. SQL Bake-off - November 7, 2011
Welcome to the XML vs. SQL bake-off, where you and your group will race other groups in
answering a set of queries!
The data set is given to you in JSON, and you will have to choose to convert it to either XML or
SQL for querying. (Hint: look at the queries before deciding whether to use XML or SQL!)
We’ve provided starter code to get you most of the way to either creating an XML file or creating
a CSV file to load into SQLite. You can run the starter code and queries on your ow n machine if
you have python, plus SQLite (for SQL) or Saxon or Kernow (for XML). You may also choose
to use the Corn cluster.
Data set: /usr/class/cs145/bakeoff/bakeoff_cookbook.json
Starter code: /usr/class/cs145/bakeoff/bakeoff_starter.py
Queries:
1. Find the titles of all recipes in the breakfast food section.
2. Find the number of recipes with more than 5 ingredients.
3. Find the average number of ingredients needed for a recipe.
4. Find the number of different ingredients in this recipe book.
5. Find the recipe with the fewest number of ingredients.
6. Find the average number of ingredients needed for recipes requiring butter.
7. For recipes with more than 4 ingredients, find the 4th ingredient.
8. Find recipes requiring at least ½ tsp of two or more ingredients. (Don’t worry about
converting measurements, just look at ingredients measured in tsp.)
Once you’re finished, bring your solutions up to the TAs to have them checked!
docsity.com

Partial preview of the text

Download XML vs. SQL Bake-off: Analyzing Recipes with JSON Data and more Study notes Introduction to Database Management Systems in PDF only on Docsity!

XML vs. SQL Bake-off - November 7, 2011

Welcome to the XML vs. SQL bake-off, where you and your group will race other groups in answering a set of queries! The data set is given to you in JSON, and you will have to choose to convert it to either XML or SQL for querying. (Hint: look at the queries before deciding whether to use XML or SQL!) We’ve provided starter code to get you most of the way to either creating an XML file or creating a CSV file to load into SQLite. You can run the starter code and queries on your own machine if you have python, plus SQLite (for SQL) or Saxon or Kernow (for XML). You may also choose to use the Corn cluster. Data set: /usr/class/cs145/bakeoff/bakeoff_cookbook.json Starter code: /usr/class/cs145/bakeoff/bakeoff_starter.py Queries:

  1. Find the titles of all recipes in the breakfast food section.
  2. Find the number of recipes with more than 5 ingredients.
  3. Find the average number of ingredients needed for a recipe.
  4. Find the number of different ingredients in this recipe book.
  5. Find the recipe with the fewest number of ingredients.
  6. Find the average number of ingredients needed for recipes requiring butter.
  7. For recipes with more than 4 ingredients, find the 4th ingredient.
  8. Find recipes requiring at least ½ tsp of two or more ingredients. (Don’t worry about converting measurements, just look at ingredients measured in tsp.) Once you’re finished, bring your solutions up to the TAs to have them checked!

docsity.com