Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

. Open a text editor to begin writing your SQL script that will contain your SQL statements. ( You may use any program that allow

. Open a text editor to begin writing your SQL script that will contain your SQL statements. (You may use
any program that allow you to create .sql files (e.g., Notepad, Wordpad, Notes, TextEdit, Notepad++,
etc.)
2. Name the file M02_HOL_LastName_FirstName.sql (e.g., M02_HOL_Doe_John.sql).
3. Complete steps B-D below.
4. Save the statements in your script in the order in which the tables should be created (based on the
foreign key constraints).
5. Execute your script to ensure it runs without errors. (If your code produces errors, work to resolve them
before submitting.)
6. Save the script and upload it as your submission.
Points will be deducted if a .sql file is not submitted. Your script should contain 5 CREATE TABLE
statements, 11 ALTER TABLE statements (5 primary key, 5 foreign key, 1 unique key),1 multi-line
comment, and 3 single-line comments.
B. Creating Tables (30 points)
1. Write CREATE TABLE statements to create the tables listed below. Do not include constraints (i.e.,
primary keys, foreign keys) in your statements. Make sure you choose the appropriate data types and
do not forget to set the columns marked as mandatory in the diagram as NOT NULL in your statement.
CUSTOMERS
BOOKS
BOOK_CATEGORY
ORDERS
ORDER ITEMS
C. Creating Constraints (20 points)
1. Write ALTER TABLE statements to add primary key constraints to the tables you created in step 1. The
constraints you create should match the primary keys displayed in the ERD.
2. Write ALTER TABLE statements to add foreign key constraints to the tables you created in step 1. The
constraints you create should match the foreign keys displayed in the ERD.
+

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases 11th British National Conference On Databases Bncod 11 Keele Uk July 7 9 1993 Proceedings Lncs 696

Authors: Michael F. Worboys ,Anna F. Grundy

1993rd Edition

3540569219, 978-3540569213

More Books

Students also viewed these Databases questions

Question

1. Define the nature of interviews

Answered: 1 week ago

Question

2. Outline the different types of interviews

Answered: 1 week ago