Section 1 Using SQL, create tables according to the given schema shown in Figure 1. The ER diagram is shown in Figure 3. You must create your database using exactly the same names (case sensitive) for tables and attributes, using the given type. The type of each attribute is defined in Figure 2. You are required to specify the following constraints: domain constraint, entity integrity constraint, key constraint, and referential integrity constraint. customer (cid, name, address) orders (oid, order_date, cid) contain_book(oid, isbn, no_of_copy) publisher (pid, name, address, phone) book (isbn, title, btype, price, pub_date, pid) author (aid, fname, Iname) written by(isbn, aid) editor (eid, fname, Iname) edited_by(eid, isbn)

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Question

Create table statements (file name must be: 1_create_table.txt). Make sure you specify primary keys and foreign keys. Specifying “not null” constraint is optional. Specifying “on delete action” and “on update action” are optional.

 

**Section 1**

Using SQL, create tables according to the given schema shown in Figure 1. The ER diagram is shown in Figure 3. You must create your database using exactly the same names (*case sensitive*) for tables and attributes, using the given type. The type of each attribute is defined in Figure 2. You are required to specify the following constraints: domain constraint, entity integrity constraint, key constraint, and referential integrity constraint.

### Figure 1 Schema Explanation

The schema outlines several tables and their relationships:

- **customer (cid, name, address)**: Manages customer details including a customer ID, name, and address.
- **orders (oid, order_date, cid)**: Contains orders with an order ID, order date, and a foreign key relating to the customer.
- **contain_book (oid, isbn, no_of_copy)**: Relates orders to books with the order ID, ISBN, and the number of copies.
- **publisher (pid, name, address, phone)**: Includes publisher details with a publisher ID, name, address, and phone.
- **book (isbn, title, btype, price, pub_date, pid)**: Details about books, including ISBN, title, book type, price, publication date, and publisher ID.
- **author (aid, fname, lname)**: Stores author information with an author ID, first name, and last name.
- **written_by (isbn, aid)**: Connects books to authors using ISBN and author ID.
- **editor (eid, fname, lname)**: Contains editor details, including editor ID, first name, and last name.
- **edited_by (eid, isbn)**: Links editors to books through editor ID and ISBN.

### Relationships

Arrows and lines indicate relationships between tables, denoting primary and foreign key associations:

- **orders** references **customer** through `cid`.
- **contain_book** references **orders** by `oid` and **book** by `isbn`.
- **book** references **publisher** using `pid`.
- **written_by** links **book** to **author** by `isbn` and `aid`.
- **edited_by** connects **editor** and **book** via `eid` and `isbn`.

These associations ensure data consistency and integrity across the database.
Transcribed Image Text:**Section 1** Using SQL, create tables according to the given schema shown in Figure 1. The ER diagram is shown in Figure 3. You must create your database using exactly the same names (*case sensitive*) for tables and attributes, using the given type. The type of each attribute is defined in Figure 2. You are required to specify the following constraints: domain constraint, entity integrity constraint, key constraint, and referential integrity constraint. ### Figure 1 Schema Explanation The schema outlines several tables and their relationships: - **customer (cid, name, address)**: Manages customer details including a customer ID, name, and address. - **orders (oid, order_date, cid)**: Contains orders with an order ID, order date, and a foreign key relating to the customer. - **contain_book (oid, isbn, no_of_copy)**: Relates orders to books with the order ID, ISBN, and the number of copies. - **publisher (pid, name, address, phone)**: Includes publisher details with a publisher ID, name, address, and phone. - **book (isbn, title, btype, price, pub_date, pid)**: Details about books, including ISBN, title, book type, price, publication date, and publisher ID. - **author (aid, fname, lname)**: Stores author information with an author ID, first name, and last name. - **written_by (isbn, aid)**: Connects books to authors using ISBN and author ID. - **editor (eid, fname, lname)**: Contains editor details, including editor ID, first name, and last name. - **edited_by (eid, isbn)**: Links editors to books through editor ID and ISBN. ### Relationships Arrows and lines indicate relationships between tables, denoting primary and foreign key associations: - **orders** references **customer** through `cid`. - **contain_book** references **orders** by `oid` and **book** by `isbn`. - **book** references **publisher** using `pid`. - **written_by** links **book** to **author** by `isbn` and `aid`. - **edited_by** connects **editor** and **book** via `eid` and `isbn`. These associations ensure data consistency and integrity across the database.
### Database Schema Explanation

This schema represents a database designed for managing a system that involves customers, orders, books, authors, publishers, and editors. Below is a detailed description of each key component and its attributes:

1. **Customer Table**
   - **cid**: CHAR(9) - Customer ID
   - **name**: VARCHAR(20) - Customer name
   - **address**: VARCHAR(80) - Customer address

2. **Orders Table**
   - **oid**: CHAR(9) - Order ID
   - **order_date**: DATE - The date when the order was placed
   - **cid**: CHAR(9) - Customer ID (references customer table)

3. **Contain_Book Table**
   - **oid**: CHAR(9) - Order ID (references orders table)
   - **isbn**: CHAR(10) - ISBN of the book
   - **no_of_copy**: INT - Number of copies ordered

4. **Publisher Table**
   - **pid**: CHAR(10) - Publisher ID
   - **name**: VARCHAR(30) - Publisher name
   - **address**: VARCHAR(80) - Publisher address
   - **phone**: CHAR(10) - Publisher phone number

5. **Book Table**
   - **isbn**: CHAR(10) - International Standard Book Number
   - **title**: VARCHAR(100) - Title of the book
   - **btype**: VARCHAR(15) - Book type or genre
   - **price**: DECIMAL(10,2) - Price of the book
   - **pub_date**: DATE - Publication date
   - **pid**: CHAR(10) - Publisher ID (references publisher table)

6. **Author Table**
   - **aid**: CHAR(4) - Author ID
   - **fname**: VARHAR(15) - First name of the author
   - **lname**: VARHAR(15) - Last name of the author

7. **Written_By Table**
   - **isbn**: CHAR(10) - ISBN of the book (references book table)
   - **aid**: CHAR(4) - Author ID (references author table)

8. **Editor Table**
   - **eid**: CHAR(4) - Editor ID
   - **fname**: VACCHAR(
Transcribed Image Text:### Database Schema Explanation This schema represents a database designed for managing a system that involves customers, orders, books, authors, publishers, and editors. Below is a detailed description of each key component and its attributes: 1. **Customer Table** - **cid**: CHAR(9) - Customer ID - **name**: VARCHAR(20) - Customer name - **address**: VARCHAR(80) - Customer address 2. **Orders Table** - **oid**: CHAR(9) - Order ID - **order_date**: DATE - The date when the order was placed - **cid**: CHAR(9) - Customer ID (references customer table) 3. **Contain_Book Table** - **oid**: CHAR(9) - Order ID (references orders table) - **isbn**: CHAR(10) - ISBN of the book - **no_of_copy**: INT - Number of copies ordered 4. **Publisher Table** - **pid**: CHAR(10) - Publisher ID - **name**: VARCHAR(30) - Publisher name - **address**: VARCHAR(80) - Publisher address - **phone**: CHAR(10) - Publisher phone number 5. **Book Table** - **isbn**: CHAR(10) - International Standard Book Number - **title**: VARCHAR(100) - Title of the book - **btype**: VARCHAR(15) - Book type or genre - **price**: DECIMAL(10,2) - Price of the book - **pub_date**: DATE - Publication date - **pid**: CHAR(10) - Publisher ID (references publisher table) 6. **Author Table** - **aid**: CHAR(4) - Author ID - **fname**: VARHAR(15) - First name of the author - **lname**: VARHAR(15) - Last name of the author 7. **Written_By Table** - **isbn**: CHAR(10) - ISBN of the book (references book table) - **aid**: CHAR(4) - Author ID (references author table) 8. **Editor Table** - **eid**: CHAR(4) - Editor ID - **fname**: VACCHAR(
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
SQL Query
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education