Question: *** PLEASE FOLLOW ALL THE INSTRUCTIONS CAREFULLY *** Create a database/schema with the name CSE535HW1kjkell13 Inside this database create the following tables: BOOK, with attributes

*** PLEASE FOLLOW ALL THE INSTRUCTIONS CAREFULLY ***

Create a database/schema with the name CSE535HW1kjkell13

Inside this database create the following tables:

BOOK, with attributes isbn, title, num-pages, publisher, year, genre, price. The first attribute (isbn) should be the primary key.

CUSTOMER, with attributes customer-id, name, address, city, state, zip, age. The first attribute (customer-id) should be system generated and the primary key

SALES, with attributes: isbn, custid, num-copies, day, month, year, total. The first attribute (isbn) is a foreign key to BOOK and the second (custid) a foreign key to CUSTOMER. The key of this table is the two foreign keys together.

Enforce the following using CHECKS:

The year of a book should be earlier than the current date (system date).

In BOOK, the price should be a number between 1 and 100

In BOOK, the number of pages should be a number between 1 and 500.

In CUSTOMER, the age should be a number between 12 and 100.

In SALES, the number of copies should be a number between 1 and 10

*NOTE: you will have to pick adequate data types for each attribute (if youre not familiar with isbns, look them up). Make sure to declare all primary key and foreign keys in order to have integrity constraints.

Insert at least 4 tuples (rows) into BOOK, 5 into CUSTOMER and 8 into SALES. You can make up the values, but they should be valid data, i.e., respecting all constraints. Make sure all books are included in some sale.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!