Write an SQL statement that will:
List the salesmen that have sold autos with rebate amounts greater than $3500.
Use the following database schema to write your SQL statement.
AUTOS (AutoID, Make, Model, Year, MSRP, RebateID)
SALESMAN (SMID, SMFName, SMLName, MgrID)
MANAGER (MgrID, MgrFName, MgrLName)
REBATE (RebateID, Description, RebateAmount)
AUTOSALES (AutoID, CustomerID, SalesDate)
CUSTOMER (CustomerID, CustFName, CustLName, Email,
SMID)
Solution
Select SALESMAN.SMID,SALESMAN.SMFName,SALESMAN.SMLName
From SALESMAN,CUSTOMER,AUTOSALES , AUTOS, REBATE
Where SALESMAN.SMID=CUSTOMER.SMID And CUSTOMER.CustomerID=AUTOSALES.CustomerId And AUTOSALES.AutoID= AUTOS.AutoID AND AUTOS.RebateID= REBATE.RebateID And REBATE.RebateAmount>3500
Explanation
We are doing the cross product of tuples from SALESMAN,CUSTOMER,AUTOSALES , AUTOS and REBATE tables and in the where condition we choose the correct tuples by equating respective attributes from different tables and selecting RebateAmount>3500. For these set of tuples we are printing the SMID,SalesmanFirstName and SalesmanLastName.
Write an SQL statement that will: List the salesmen that have sold autos with rebate amounts...
NEED THE SQL QUERIES ASAP PLEASE(LIKE 1 HOUR) THE ONES WITH ID ARE PRIMARY KEYS OR FOREIGN etc Customer [ CustID, LastName, FirstName, Address, City, State, Zip, Phone, Fax, Email] Product [ ProdID, Description, Color, Size, Pack] Sales [ TransID, CustID, ProdID, Price, Quantity, Amount] Write SQL statement to produce a list of unique products and their prices from the Sales table. Please ensure that the products do not repeat. Write an SQL statement to list ProdID and Description for...
Consider the following database and answer the questions below. a) Write the SQL statement the displays the names of the students who have enrolled in the Database Systems course b) Write the SQL statement that displays a list of the students whose names start with 'S' c) Write the SQL statement that displays the Student ID, Student Name, Course ID, and Grade for students that passed at least one course with a grade better than B+ (i.e. A-, A, and...
A database used for a toy store that keeps track of the inventory and purchase orders from the store. All clients will have their membership ID card to shop. This database will help the store to keep track of their orders. It will also help the store to know how many products are available in the inventory. It is necessary to have a membership to purchase a product. The customer can also bring coupons to get discount. Key attributes: Salesman:...
A database used for a toy store that keeps track of the inventory and purchase orders from the store. All clients will have their membership ID card to shop. This database will help the store to keep track of their orders. It will also help the store to know how many products are available in the inventory. It is necessary to have a membership to purchase a product. The customer can also bring coupons to get discount. Key attributes: Salesman:...
There are 7 problems that require using joins. Each problem has 10 points. 1. Write an SQL command that will find any customers who have not placed orders and sort them out by CustomerID in ascending order. 2. List the employees and supervisors names for each supervisor who supervises more than two employees. 3. List the name of each employee, his or her birth date, the name of his or her manager, and the manager’s birth date for those employees...
For the below `bank' schema: customer(customerid,username,fname,lname,street1,street2,city,state,zip) account(accountid,customerid,description,) transaction(transactionid,trantimestamp,accountid,amount) A customer may have several accounts, and each account may participate in many transactions. Each transaction will have at least two records, one deducting amount from an account, and one adding amount to an account (for a single transactionid, the sum of amounts will equal zero). Using SQL, answer these questions (write a SQL query that answers these questions): 8) List the top 1% of customers (ordered by total balance). 9) Using...
I can provide my log in to my teradata database if necessary. Thanks 19:31 P B . Ch. 6 HW Assignment 4 - Saved SG 59% Make db_pvfc11_big as your default database when you log into SQL Assistant: Username userid Password: Default Database: db pufc11_big Database Descriptions Provide proof of ownership by using Current_User attribute in all SELECT statements. Use the PVFC database to answer the following questions: 1. For each customer, list the CustomerID and the total number of...
write a sql query that returns Which states have more than one customer? List the states and the number of customers for those states. The list must not include the states that do not have more than one customer. CUSTOMER_T CustomerName, Street, City, State, Zip,
Write the following SQL statements in Microsoft Access by using the Books database from Week 2 Assignment 2. Once complete, copy and paste the SQL statements in a Microsoft Word document: Write SQL statements: To update the publisher name from READ WITH US to READ FOR US To verify the updated name field for the publisher with ID 6 To make the following updates to the Publisher table (be careful with WHERE): Make Contact="John Travolta" for publisher with ID number...
Write the following queries in SQL in your PROPERTY database: 1. List the properties that have been sold by real estate agencies that are located in the same suburb as the property 2. Who is the most successful real estate agent in 2018. (Hint: who has sold and rented properties of the greatest value) 3. List the agencies that have property listings in every suburb 4. Which real estate agency (or agencies) has most number of houses available for rent...