Question

Write an SQL statement that will: List the salesmen that have sold autos with rebate amounts...

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)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

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.

Add a comment
Know the answer?
Add Answer to:
Write an SQL statement that will: List the salesmen that have sold autos with rebate amounts...
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
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