Question
Write the SQL DDL to create the following 5 tables describing cooking: recipe, ingredient, author, cook, requires: 1. An Author table where each author is
Write the SQL DDL to create the following 5 tables describing cooking: recipe, ingredient, author, cook, requires:
1. An Author table where each author is identified by an integer id and has a name (up to 30 characters).
2. An Ingredient table where each ingredient has an id of exactly 5 characters and a name (up to 30 characters).
3. A Recipe table where each recipe is identified by a field called id that is an integer. Other attributes include name (string up to 40 characters), author id (integer), and directions (string up to 255 characters). Make all foreign keys set to null on delete and no action (generate error) on update.
4. A Cook table where each time a recipe is made it is identified by a date/time (DATETIME). The table also has a recipe id and a comment (string up to 255 characters). Make all foreign keys set to perform cascade on delete and cascade on update.
5. A Requires table that stores what ingredients are needed in a recipe. This table has a recipe id, ingredient id, and amount (floating point number). Make all foreign keys set to cascade on both update and delete.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started