Question

Auntie Bs Antic ERD CUSTOMER OWNER PEOPLE PeoplelD CustomerSince CHARITY Peopleld FirstName LastName Address City State ZipHi, I'm trying to do my homework for my SQL Server class I keep getting stuck on the questions 1-5  I found out like how the format need to be I'm just stuck on implanting the code in.

1 Create a query that will show who picked up unsold items during the month ot May 2013. Include in your output the first and

Auntie B's Antic ERD CUSTOMER OWNER PEOPLE PeoplelD CustomerSince CHARITY Peopleld FirstName LastName Address City State Zip Phone CellPhone EMail PeopleType CharityID Name Address City State WORKERS PeoplelD HireDate TermDate SSN ip Phone ContactID ORDERS OrderlD OrderDate CustomerlD EmployeelD DONATION DonationID DonationDate CharityID EmployeelD ITEM ItemID ItemTypelD Color Size MaxPrice MinPrice OwnerID ORDER ITEM OrderlD ItemID price ITEM DONATION DonationID ItemID value ITEM TYPE ItemTypelD ITEM PICKUP ItemID Date Name Description
1 Create a query that will show who picked up unsold items during the month ot May 2013. Include in your output the first and last name of the owner, along with the name of the item, max price and pick up date. Order your output by Pick up date. My output looked like the following: Name Price Date Bateman Tara LeMay Michael Roswell Furniture DR Clothes Ladies Toys Child 222.80 2013-05-01 2013-05-04 2013-05-12 12.00 2) Using a SUBQUERY, create a query that will show those orders for toys. In your output include the order id, item id and price. My output looked like the following: orderi it price 1010 1012 1012 1013 1015 1034 1036 1040 1040 1042 1042 1042 1042 1013 1024 1025 1022 1023 1041 1046 1062 1064 1074 1075 1077 1079 10.50 10.50 12.00 15.00 3) Using a SUBQUERY find those orders that sold for greater than the average priced sold item. Include in your query the grderid, orderdate and price. Sort your output by price so that the most expensive item is first. My output looked like the following: orderid orderDate price 2001 2013-03-23 1035 2013-04-21 3022 2013-02-28 2002 2013-04-16 1033 2013-03-21 1032 2013-03-20 1031 2013-05-01 1019 2012-03-11 1038 2013-05-02 1016 2011-12-11 1018 2012-02-01 3021 2013-03-30 1004 2010-11-05 1020 2012-03-25 175.50 145.00 145.00 125.00 100.0 85.00 80.00 57.50 17.95 47.50 32.50 30.00 4) Using a SET OPERATOR find out which charities have not received donations. Include in your output the charity name. My output looked like the following: TA Angels Traders Mother Wattles Purple Heart Ron McDonald House Salvation Army St. Francis IIome st. Raja Home Create a query that will show the first and last name of those employees that have not taken an order. your output the first and last name of the employee along with the order id. Suppress those records of employees that have taken orders. Order your output by last name. Your output should look like the following: 5) Display in orderi Debbie David rom Dukes Rakesh Renl NULL NUL.T. NULL Baratheon Michele Bob Mark NULL NULL NULL.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

2) SELECT a.OrderID , b.ItemID , a.price FROM ORDER_ITEM a , ITEM b WHERE a.ItemID = b.ItemID AND b.ItemTypeID = (SELECT ItemTypeID FROM ITEM WHERE ItemTypeID = "Toys" );

3) SELECT a.OrderID , a.OrderDate , b.price FROM ORDERS a , ORDER_ITEM b WHERE a.OrderID = b.OrderID AND b.price > (SELECT avg((MaxPrice+MinPrice)/2) FROM ITEM);

4) SELECT Name FROM CHARITY WHERE (SELECT CharityID FROM CHARITY MINUS SELECT CharityID FROM DONATION);

For question 1 and 5 you need to use multiple inner join but in some table there is no column same so I am use join here.

  

Add a comment
Know the answer?
Add Answer to:
Hi, I'm trying to do my homework for my SQL Server class I keep getting stuck on the questions 1-...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 3. Create a query that will show how much money was spent by those people living in Clinton Towns...

    3. Create a query that will show how much money was spent by those people living in Clinton Township. Include in your output the first and last name as one column, the subtotal of what they spent, the sales tax and the grand total. Make sure you round your sales tax to 2 decimals. Order your output by the customer last name. My output looked like the following (I shortened my money columns due to page size. You do not...

  • Hello, I need help answering all 8 of these questions for my BIS 422 class. I...

    Hello, I need help answering all 8 of these questions for my BIS 422 class. I need the appropriate MySQL script to use for these questions Provide the SQL for the following data requests. Your SQL should be written as a single script that can be pasted into MySQL and run without edits. Make sure you use the proper notation for your comments (see the practice solution for an example of the format). There will be a 5% deduction for...

  • DROP TABLE IF EXISTS customers; DROP TABLE IF EXISTS orders; DROP TABLE IF EXISTS order_details; DROP...

    DROP TABLE IF EXISTS customers; DROP TABLE IF EXISTS orders; DROP TABLE IF EXISTS order_details; DROP TABLE IF EXISTS items; DROP TABLE IF EXISTS artists; DROP TABLE IF EXISTS employees; -- create tables CREATE TABLE customers (    customer_id INT ,    customer_first_name VARCHAR(20),    customer_last_name VARCHAR(20) NOT NULL,    customer_address VARCHAR(50) NOT NULL,    customer_city VARCHAR(20) NOT NULL,    customer_state CHAR(2) NOT NULL,    customer_zip CHAR(5) NOT NULL,    customer_phone CHAR(10) NOT NULL,    customer_fax CHAR(10),    CONSTRAINT customers_pk...

  • Part I. Create a library check-out database using Microsoft SQL Server that stores data about books,...

    Part I. Create a library check-out database using Microsoft SQL Server that stores data about books, patrons, and the check-out process. Books (BookID, BookName, Author, YearPublished) Patrons (PatronsID, PatronsName, PatronsAddress, PatronsBirthday) CheckInOut (TransactionID, PatronID, BookID, CheckOutDate, NumDay, ReturnDate, Late, Fees, Paid) - the NumDay field contains the number of days patrons can keep the book, if the return date is over the number of day, then the Late field will have a Y value and a fee of $1.00 per...

  • It's my python homework. Not Java. Design type 1: # Creating an object of the class...

    It's my python homework. Not Java. Design type 1: # Creating an object of the class "DeAnzaBurger" theOrder = DeAnzaBurger() # calling the main method theOrder.main() # And the class is like: class DeAnzaBurger: # You may need to have a constructor def __init__(self): self._orderDict = {} self._priceBeforeTax = 0 self._priceAfterTax = 0 # you may have the tax rate also as an instance variable. But as I mentioned, you can use your # own deign.    .... # That...

  • If possible please just send the SQL statement. Thank you Each question within deliverable 3 must begin on a new page and be sure to document the question as the title of each item at the top o...

    If possible please just send the SQL statement. Thank you Each question within deliverable 3 must begin on a new page and be sure to document the question as the title of each item at the top of each page. Also, using a 12-point font, include the SQL statement and then provide a screen shot of each query. The screen shots must include both the SQL statement and the results for each item below based on the data entered in...

  • Need help with C++ assignment Assignment 1 and .txt files are provided at the bottom. PART...

    Need help with C++ assignment Assignment 1 and .txt files are provided at the bottom. PART A PART B Assignment 1 #include <iostream> #include <string> #include <fstream> #include <iomanip> #include <stdio.h> #include <ctype.h> #include <string.h> #include <algorithm> using namespace std; /** This structure is to store the date and it has three integer fields **/ struct Date{    int day;    int month;    int year; }; /** This structure is to store the size of the box and it...

  • Write MySQL query statements for the questions below including the output that proves the accuracy of...

    Write MySQL query statements for the questions below including the output that proves the accuracy of your solution. Your answers should be stored in a text file that captures your interaction with MySQL. 1. Find the movieID, title, year and DVDPrice of all movies where the DVD-Price is equal to the discountPrice. 2. Find the actorID, lastName, firstName, middleName, and suffix of all actors whose middleName is not NULL. 3. Suppose you remember a movie quote as “Play it again,...

  • Use only a single SQL statement for each of the following questions 1 Give a listing of all the ssns,first names and the class descriptions of all the classes the students are taking. If there a...

    Use only a single SQL statement for each of the following questions 1 Give a listing of all the ssns,first names and the class descriptions of all the classes the students are taking. If there are no class _descriptions display 'No description is available yet'. (USE NVL) 2 Give a listing of only the lname and the class_code for students who are taking 'Introduction to C programming'. (Inner join) 3 Give a lising of all the class_descriptions and the number...

  • I have this case study to solve. i want to ask which type of case study...

    I have this case study to solve. i want to ask which type of case study in this like problem, evaluation or decision? if its decision then what are the criterias and all? Stardust Petroleum Sendirian Berhad: how to inculcate the pro-active safety culture? Farzana Quoquab, Nomahaza Mahadi, Taram Satiraksa Wan Abdullah and Jihad Mohammad Coming together is a beginning; keeping together is progress; working together is success. - Henry Ford The beginning Stardust was established in 2013 as a...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT