Consider a Superstore Database which consists of 3 tables, Orders, Returns, and Managers. The CSV files have been provided along with this DOC file in the Midterm 2 Link in the Moodle. Answer the questions as below: 1. Create the three tables with their SQL queries in a newly created Database Superstore and paste the code in text format below. Make sure to assign primary and foreign keys as needed. Be careful while using the Unique and NOT NULL constraints. Use them only when required. Use correct data type for each attribute in an Entity. Use PG-ADMIN to create these tables as the tables will be needed to answer questions in question 2. 2. Use the created table as in Question 1, solve the problems as mentioned below. You will have to import the respective CSV files of the above-created tables as without them, it is impossible to solve the questions below. If you are not able to upload the files successfully, do not leave the query questions. Just write the query to the best of your knowledge. Do not copy. To be graded for the screenshot answer, you must upload the CSV properly and paste the resulting screenshot of the queries as asked. • Write a query to find the order for the order having the Difference between Shipping Date and Order Date > '7 days' and the priority of the order is 'critical'. • Write a query to find the contribution of total Sales by the 'Home Office' Customer Segment in July of 2012? For example, if in July 2012, the total sum of sales across all Customer segments is 100 and 'Home Office' contributes 30 to the sum of sales. Then the answer would be 30/100, which is 0.3. Hint: There are altogether 4 distinct Customer segments. ° Write Query to Find out which Product Sub-Category has a sum of Shipping Cost to the sum of Sales ratio > 0.03. Write a query to find the details of the orders that are returned?
Consider a Superstore Database which consists of 3 tables, Orders, Returns, and Managers. The CSV files have been provided along with this DOC file in the Midterm 2 Link in the Moodle. Answer the questions as below: 1. Create the three tables with their SQL queries in a newly created Database Superstore and paste the code in text format below. Make sure to assign primary and foreign keys as needed. Be careful while using the Unique and NOT NULL constraints. Use them only when required. Use correct data type for each attribute in an Entity. Use PG-ADMIN to create these tables as the tables will be needed to answer questions in question 2. 2. Use the created table as in Question 1, solve the problems as mentioned below. You will have to import the respective CSV files of the above-created tables as without them, it is impossible to solve the questions below. If you are not able to upload the files successfully, do not leave the query questions. Just write the query to the best of your knowledge. Do not copy. To be graded for the screenshot answer, you must upload the CSV properly and paste the resulting screenshot of the queries as asked. • Write a query to find the order for the order having the Difference between Shipping Date and Order Date > '7 days' and the priority of the order is 'critical'. • Write a query to find the contribution of total Sales by the 'Home Office' Customer Segment in July of 2012? For example, if in July 2012, the total sum of sales across all Customer segments is 100 and 'Home Office' contributes 30 to the sum of sales. Then the answer would be 30/100, which is 0.3. Hint: There are altogether 4 distinct Customer segments. ° Write Query to Find out which Product Sub-Category has a sum of Shipping Cost to the sum of Sales ratio > 0.03. Write a query to find the details of the orders that are returned?
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
Database

Transcribed Image Text:Consider a Superstore Database which consists of 3 tables, Orders, Returns, and Managers. The CSV files
have been provided along with this DOC file in the Midterm 2 Link in the Moodle. Answer the questions as
below:
1. Create the three tables with their SQL queries in a newly created Database Superstore and paste the
code in text format below. Make sure to assign primary and foreign keys as needed. Be careful while
using the Unique and NOT NULL constraints. Use them only when required. Use correct data type
for each attribute in an Entity. Use PG-ADMIN to create these tables as the tables will be needed to
answer questions in question 2.
2. Use the created table as in Question 1, solve the problems as mentioned below. You will have to
import the respective CSV files of the above-created tables as without them, it is impossible to solve
the questions below. If you are not able to upload the files successfully, do not leave the query
questions. Just write the query to the best of your knowledge. Do not copy. To be graded for the
screenshot answer, you must upload the CSV properly and paste the resulting screenshot of the
queries as asked.
• Write a query to find the order for the order having the Difference between Shipping Date and
Order Date > '7 days' and the priority of the order is 'critical'.
• Write a query to find the contribution of total Sales by the 'Home Office' Customer Segment in
July of 2012? For example, if in July 2012, the total sum of sales across all Customer segments
is 100 and 'Home Office' contributes 30 to the sum of sales. Then the answer would be 30/100,
which is 0.3. Hint: There are altogether 4 distinct Customer segments.
°
Write Query to Find out which Product Sub-Category has a sum of Shipping Cost to the sum of
Sales ratio > 0.03.
Write a query to find the details of the orders that are returned?
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps

Recommended textbooks for you

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education

Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY