Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The Answers have to be written in SQlite 3. You have been provided with the following relational schema. users(email, name, pwd, city, gender) products(pid, descr)

The Answers have to be written in SQlite 3.

You have been provided with the following relational schema.

  • users(email, name, pwd, city, gender)
  • products(pid, descr)
  • sales(sid, lister, pid, edate, descr, cond, rprice)
  • bids(bid, bidder, sid, bdate, amount)
  • items(sid, no, pid, descr)
  • reviews(reviewer, reviewee, rating, rtext, rdate)
  • previews(rid, pid, reviewer, rating, rtext, rdate)
create table users ( email char(20), name char(16), pwd char(4), city char(15), gender char(1), primary key (email) ); create table products ( pid char(4), descr char(20), primary key (pid) ); create table sales ( sid char(4), lister char(20) not null, pid char(4), edate date, descr char(25), cond char(10), rprice int, primary key (sid), foreign key (lister) references users, foreign key (pid) references products ); create table bids ( bid char(20), bidder char(20) not null, sid char(4) not null, bdate date, amount float, primary key (bid), foreign key (bidder) references users, foreign key (sid) references sales ); create table items ( sid char(4), no int, pid char(4), descr char(25), primary key (sid,no), foreign key (sid) references sales on delete cascade, foreign key (pid) references products ); create table reviews ( reviewer char(20), reviewee char(20), rating float, rtext char(20), rdate date, primary key (reviewer, reviewee), foreign key (reviewer) references users, foreign key (reviewee) references users ); create table previews ( rid int, pid char(4), reviewer char(20) not null, rating float, rtext char(20), rdate date, primary key (rid), foreign key (pid) references products, foreign key (reviewer) references users ); create table endorses ( rid int, endorser char(20), primary key (rid, endorser), foreign key (rid) references previews, foreign key (endorser) references users );

Question 5 - Find all undervalued sales that have the term xbox in their descriptions; a sale s is undervalued if it is associated to a product p and p is associated with another sale s' and the highest bid for s' is more than twice the amount of the highest bid for s. Matching of the keyword xbox must be case-insensitive. For each qualifying sale s, list sid, lister of the sale, pid of the product associated with the sale and the maximum bid amount offered for the 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_2

Step: 3

blur-text-image_3

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 And Expert Systems Applications 24th International Conference Dexa 2013 Prague Czech Republic August 2013 Proceedings Part 2 Lncs 8056

Authors: Hendrik Decker ,Lenka Lhotska ,Sebastian Link ,Josef Basl ,A Min Tjoa

2013th Edition

3642401724, 978-3642401725

More Books

Students also viewed these Databases questions

Question

Which form of proof do you find least persuasive? Why?

Answered: 1 week ago