Write SQL statements to retrieve the following: a. Name of all sellers b. Name o
ID: 3823413 • Letter: W
Question
Write SQL statements to retrieve the following:
a. Name of all sellers
b. Name of all buyers
c. Name of sellers who have given a rating of 1
d. Name of buyers who have received a rating of 1
Consider an ONLINE AUCTION database system in which members (buyers and sellers) participate in the sale of items. The data requirements for this system are summarized as follows The online site has members, each of whom is identified by a unique member number and is described by an e-mail address, name, password, home address, and phone number A member may be a buyer or a seller. A buyer has a shipping address recorded in the database. A seller has a bank account number and routing number recorded in the database. Items are placed by a seller for sale and are identified by a unique item number assigned by the system. Items are also described by an item title, a description, starting bid price, bidding increment, the start date of the auction, and the end date of the auction. Items are also categorized based on a fixed classification hierarchy (for example, a modem may be classified as COMPUTER HARDWARE MODEM). Buyers make bids for items they are interested in. Bid price and time of bid are recorded. The bidder at the end of the auction with the highest bid price is declared the winner, and a transaction between buyer and seller may then proceed. The buyer and seller may record feedback regarding their completed transactions. Feedback contains a rating of the other party participating in the transaction (1-10) and a comment.Explanation / Answer
* assuming members table contains additional column ( account_number, shipping_address and routing_number )
1) name of all sellers
select name from members where accout_number is not null and routing_number is not null;
2) name of all buyers
select name from members where shipping_address is not null;
** assuming you will create table like this for feedback
TABLE NAME: feedback
Columns : seller_id buyer_id rating comment
Both 3 and 4 are similar and can be queried from single table.
differece is that inner query would return seller_id for 3rd query and buyer_id for 4th query
3) Name of Sellers who have given a rating of 1
select m.name from members m where m.member_id=(select seller_id from feedback where rating<=1);
4) Name of Buyers who have received a rating of 1
select m.name from members m where m.member_id=(select buyer_id from feedback where rating<=1);
hope this helps.
if in case of doubt, comment here. i'll be very happy to help you.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.