Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You are given the following database structure, pay attention to all keys as it may affect your answer. Please answer the following requests in Relational

You are given the following database structure, pay attention to all keys as it may affect your answer.

image text in transcribed

Please answer the following requests in Relational algebra:

image text in transcribed

I will upvote thank you !

Assume the same database as in Homeworks 1 and 2: - BOOK(isbn, title, num-pages, publisher, year, genre, price, aut-id). The first attribute is the primary key; the last one is a foreign key to AUTHOR. - CUSTOMER (customer-id, name, address, city, state, zip, age). The first attribute is the primary key. - SALES(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. - AUTHOR (author-id, name, dob, nationality, address, city, state, zip). The first attribute is the primary key. Attribute dob stands for 'date of birth'. Attribute nationality has values like 'British', 'Australian', etc. Attribute genre has values like 'sci-fi', 'romance', etc. Note that this schema assumes that each book has one and only one author, but it can be sold to different customers at different times. A customer can buy several copies of several books. 1. Write the following queries in Relational Algebra: (a) List the name and address of customers who have bought either a sci-fi book or a romance book (recall that 'sci-fi' and 'romance' are values of genre). (b) List the name and address of customers who have bought both a sci-fi book and a romance book (recall that 'sci-fi' and 'romance' are values of genre). (c) List the name and address of customers who have never bought a sci-fi book. (d) List the name and address of customers who have bought at least two different books (not two copies of a book)

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

Database Horse Betting The Road To Absolute Horse Racing 2

Authors: NAKAGAWA,YUKIO

1st Edition

B0CFZN219G, 979-8856410593

More Books

Students also viewed these Databases questions