BA is an online auction Web site. People can buy and sell items in this Web site
ID: 3820292 • Letter: B
Question
BA is an online auction Web site. People can buy and sell items in this Web site. Buyers are people who like to buy items, and sellers are people who like to sell items. Each seller can sell items. Each item has a bidding start time, an end time, and an owner. Sellers are owners of their item. The start time and end time include the date as well. Each seller has a name, contact information, and credit card information. They also have a user name and a password. Contact information consists of an address, an email, and a telephone. An address consists of a street number and name, city, state, and zip code. Credit card information consists of owner name, card number, and expiration date. Each item has a name, condition, an initial price, a description, quantity, one or more pictures, and an owner. The condition could be New, Refurbished, or Explained. If the condition of an item is set to Explained, the seller should explain about the item condition in the item description. Each buyer has a name, contact information, and credit card information. They also have a user name and a password. Buyers can bid on items. Once a bid is made, buyers are accountable for their bid. In other words, buyers cannot simply remove their bid. If they change their mind, all they can do is to update their bid with the price of zero. Of course, they can do that before the auction expires. After an auction expires, the buyer with the highest bid is the winner. BA likes to have a set of statistics about the system as follows: The most active seller (the one who has offered the most number of items) The most active buyer (the one who has bought the most number of items) The most popular seller (the one who sold the most number of items) The most expensive item sold ever The most expensive item available The cheapest item sold ever The cheapest item available
Explanation / Answer
Ans 2- Most active Buyer-
Consider we have a table Bidding_Info(Bidding_id,Buyer_id,Bidding_date,IsActive)
Query-
Ans 1- Most active seller : -
Lets assume we have a product table which has the seller Id and product_id as well
Product(product_id, product name,seller_id, list_out_date,cost)
Ans 3- Consider a table Items_Sold_Info( Product_id,seller_id,sold_date,buyer_id,cost_sold)
Ans 4- Expensive Item sold ever -
Consider a table Items_Sold_Info( Product_id,seller_id,sold_date,buyer_id,cost_sold)
select product_id,product_name from Items_Sold_Info a join Product b
on a.product_id=b.product_id where a.cost_sold = (select max(cost_sold) from Items_Sold_Info);
Ans 5- Most costly item available-
Product(product_id, product_name,seller_id, list_out_date,cost)
select product_id, product_name from Product where cost=(select max(cost) from product);
And 6- Cheapest Item sold ever -
Consider a table Items_Sold_Info( Product_id,seller_id,sold_date,buyer_id,cost_sold)
select product_id,product_name from Items_Sold_Info a join Product b
on a.product_id=b.product_id where a.cost_sold = (select min(cost_sold) from Items_Sold_Info);
Ans 5- Cheapest costly item available-
Product(product_id, product_name,seller_id, list_out_date,cost)
select product_id, product_name from Product where cost=(select min(cost) from product);
Thanks and Regards,
Vinay Prakash Singh
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.