Database management ) 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: 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. 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 as
(
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:
- 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.
-
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?
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 4 images