Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please show how this can be accomplished using the SQL programming language, I will upvote, thank you!! 1. Create a database/schema with name CSE535HW1Username, where

image text in transcribed

Please show how this can be accomplished using the SQL programming language, I will upvote, thank you!!

1. Create a database/schema with name CSE535HW1Username, where the last part is your username, as above. 2. Inside this database, create the following tables: - BOOK, with attributes isbn, title, num-pages, publisher, year, genre, price. The first attribute should be the primary key. - CUSTOMER, with attributes customer-id, name, address, city, state, zip, age. The first attribute should be system generated and the primary key. 1 - SALES, with attributes isbn, custid, num-copies, day, month, year, total. The first attribute is a foreign key to BOOK and the second a foreign key to CUSTOMER. The key of this table is the two foreign keys together. 3. Enforce the following using CHECKS: (a) the year of a book should be earlier than the current date (system date). (b) in BOOK, the price should be a number between 1 and 100. (c) in BOOK, the number of pages should be a number between 1 and 500. (d) in CUSTOMER, the age should be a number between 12 and 100. (e) in SALES, the number of copies should be a number between 1 and 10 . You will have to pick adequate data types for each attribute (if you're not familiar with isbns, look them up). Make sure to declare all primary key and all foreign keys in order to have integrity constraints. 4. Insert at least 4 tuples 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 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

T Sql Window Functions For Data Analysis And Beyond

Authors: Itzik Ben Gan

2nd Edition

0135861446, 978-0135861448

More Books

Students also viewed these Databases questions

Question

What is G for the reaction CaO(s)+CO2(g)CaCO3(s)

Answered: 1 week ago