Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

*** 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

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions