Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This assignment concerns the relational schema for a bookstore as shown in figure 1. create table CUSTOMER ( CID text primary key, NAME text, DOB
This assignment concerns the relational schema for a bookstore as shown in figure 1. create table CUSTOMER ( CID text primary key, NAME text, DOB date ); create table BOOK ( ISBN text primary key, TITLE text, AUTHOR text ); create table BUYS ( BID uuid primary key, CID text foreign key references CUSTOMER, ISBN text foreign key references BOOK, DATE timestamp, PRICE float ); 1. Assuming the schema in figure 1, write the following queries in Relational Algebra (RA). You may use any of the operators mentioned in class or the text, including X, A, U, N, 7, n, o, p and y. N.B. When the question says "find X where X is a relationship or entity, that means to return the primary key for X, unless otherwise specified (a) Find books written by 'Sam Spade'. (b) Find customers who are currently teens (i.e. ages 13 to 19, inclusive). (c) Find customers who are teens and bought at least one book by 'Sam Spade'. (d) Find customers who are teens and bought every book by 'Sam Spade'. (e) Find purchases that cost more than $100. (f) Find the names of customers that bought more than $100 worth of books in 01/2021. (8) Find pairs of customers that have purchased exactly the same set of books. (h) Find customers that have purchased exactly three books so far in 2021. (i) Find customers that have purchased more books than everyone else. (j) Find the names of customers that have never purchased a book
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started