Write a query to display the first name, last name, street, city, state, and zip code of any customer who purchased a Foresters Best brand top coat between 2017-7-15, and 2017-7-31. If a customer purchased more than one such product, display the customer’s information only once in the output. Sort the output by state, last name, and then first name. My code just ends in "query completed" instead of what is correct. This is what I tried. SELECT DISTINCT CUST_FNAME, CUST_LNAME, CUST_STREET, CUST_CITY, CUST_STATE, CUST_ZIP FROM LGCUSTOMER AS C, LGINVOICE AS I, LGLINE AS L, LGPRODUCT AS P, LGBRAND AS B WHERE C.CUST_CODE = I.CUST_CODE AND I.INV_NUM = L.INV_NUM AND L.PROD_SKU = P.PROD_SKU AND P.BRAND_ID = B.BRAND_ID AND BRAND_NAME = 'FORESTERS BEST' AND PROD_CATEGORY = 'Top Coat' AND INV_DATE BETWEEN '15-JUL-2011' AND '31-JUL-2011' ORDER BY CUST_STATE, CUST_LNAME, CUST_FNAME;
Write a query to display the first name, last name, street, city, state, and zip code of any customer who purchased a Foresters Best brand top coat between 2017-7-15, and 2017-7-31. If a customer purchased more than one such product, display the customer’s information only once in the output. Sort the output by state, last name, and then first name. My code just ends in "query completed" instead of what is correct. This is what I tried. SELECT DISTINCT CUST_FNAME, CUST_LNAME, CUST_STREET, CUST_CITY, CUST_STATE, CUST_ZIP FROM LGCUSTOMER AS C, LGINVOICE AS I, LGLINE AS L, LGPRODUCT AS P, LGBRAND AS B WHERE C.CUST_CODE = I.CUST_CODE AND I.INV_NUM = L.INV_NUM AND L.PROD_SKU = P.PROD_SKU AND P.BRAND_ID = B.BRAND_ID AND BRAND_NAME = 'FORESTERS BEST' AND PROD_CATEGORY = 'Top Coat' AND INV_DATE BETWEEN '15-JUL-2011' AND '31-JUL-2011' ORDER BY CUST_STATE, CUST_LNAME, CUST_FNAME;
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
Write a query to display the first name, last name, street, city, state, and zip code of any customer who purchased a Foresters Best brand top coat between 2017-7-15, and 2017-7-31. If a customer purchased more than one such product, display the customer’s information only once in the output. Sort the output by state, last name, and then first name.
My code just ends in "query completed" instead of what is correct. This is what I tried.
SELECT DISTINCT CUST_FNAME, CUST_LNAME, CUST_STREET, CUST_CITY, CUST_STATE, CUST_ZIP
FROM LGCUSTOMER AS C, LGINVOICE AS I, LGLINE AS L, LGPRODUCT AS P, LGBRAND AS B
WHERE C.CUST_CODE = I.CUST_CODE
AND I.INV_NUM = L.INV_NUM
AND L.PROD_SKU = P.PROD_SKU
AND P.BRAND_ID = B.BRAND_ID
AND BRAND_NAME = 'FORESTERS BEST'
AND PROD_CATEGORY = 'Top Coat'
AND INV_DATE BETWEEN '15-JUL-2011' AND '31-JUL-2011'
ORDER BY CUST_STATE, CUST_LNAME, CUST_FNAME;
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question
Select distinct a.CUST_FNAME, a.CUST_LNAME, a.CUST_STREET, a.CUST_CITY, a.CUST_STATE, a.CUST_ZIP from LGCUSTOMER a, LGBRAND b, LGPRODUCT c, LGINVOICE d, LGLINE e
Where a.CUST_CODE = d.CUST_CODE And b.BRAND_ID = c.BRAND_ID And d.INV_NUM = e.INV_NUM And c.PROD_SKU = e.PROD_SKU
And b.BRAND_NAME = 'Foresters Best' And PROD_CATEGORY = 'Top Coat' And d.INV_DATE > '2017/07/15' And d.INV_DATE < '2017/07/31'
Order By a.CUST_STATE, a.CUST_LNAME, a.CUST_FNAME;
However it is not ordered correctly?
Write a query to display the first name, last name, street, city, state, and zip code of any customer who purchased a Foresters Best brand top coat between 2017-7-15, and 2017-7-31. If a customer purchased more than one such product, display the customer’s information only once in the output. Sort the output by state, last name, and then first name
Solution
by Bartleby Expert
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education