(
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 nowThis is a popular solution!
Step by stepSolved in 2 steps with 4 images
- Under what circumstances would it be reasonable to assume that two select statements from the same database are consistent with one another?arrow_forwardAnswer the given question with a proper explanation and step-by-step solution. For this question use the file data1.csv The file contains information on various customers. Each customer has a unique customer id. The data also has information on age income and Gender of the customers. Space can be used as a delimiter for this file. Find the following: A) The total number of the rows in the file. B) The number of unique customer ids in the datafile. For this question create a set object which will only allow you to add unique customer ids. C) The program asks user to provide an id and prints information about that customer. Make sure to take care for the errors due to invalid id (i.e., id does not present in data). Print “id not found” when id is not found. Save the file as Solution1.java. You can use either File Reader or Scanner classes to read the data in the csv file. Your program should print the following after filling the blanks with the appropriate values Outcome: The total…arrow_forwardCreate an application which can access a database. Create a database with an application user, user specific for your application to use, and 1 table of a couple of fields properly indexed. Grant permissions for the user to access the table. (submit .SQL file) Create a simple application, language of your choice, (BE languages only, no JS or Node) which can do the following operations: (submit source code file): Connect using the application user created above. Insert into the table, and select from the table using a WHERE clause, where all fields are parameterized. Display results of the select. Use a simple web server API interface for data input and output, which can be accessed via local browser or curl.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education