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 Systems: Design, Implementation, & Management
12th Edition
ISBN:9781305627482
Author:Carlos Coronel, Steven Morris
Publisher:Carlos Coronel, Steven Morris
Chapter8: Advanced Sql
Section: Chapter Questions
Problem 69C: Update the DETAILRENTAL table to set the values in DETAIL_RETURNDATE to include a time component....
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 Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781305627482
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781305627482
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning