Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Important note: The data files attached to this assignment to be used in part II are randomly generated. PartIU ( 1 0 points ) Consider
Important note: The data files attached to this assignment to be used in part II are randomly generated.
PartIU points Consider the following logical relations for simple ecommerce:
Products PID: integer, Name: varcharx Vendor: varcharx AvailableQuantity: integer
Customers CID: integer, FullName: varcharx Email: varcharx Age: integer, Address: varcharx State: varcharx
Orders OID: integer, PID: integer, CID: integer, OrderQuantity: integer, OrderDate: DATE, TotalCost: decimal
The "PID" and "CID" fields in Orders relation are foreign keys referencing the "PID" field of the Products relation and "CID"
field of the Customers relation.
Attached with this assignment are CSV files with data for the three relations described above: Products, Customers,
and Orders. Scan the data records stored in these files to decide on the size the value of of the varchars and decimals in
these logical relations.
Through MySQL workbench or shell, use SQL to create a new database named eCommerceApp build the relations tables
mentioned above, and place the constraints eg default values you find appropriate.
In this assignment, as detailed below, you will create a simple Python or Java terminalbased application that connects to the
database you created and interacts with it Revise the PythonSQ tutorial or the JavaSQL tutorial the material is on Canvas to
do the following tasks.
Note: You can create a simple python or java terminalconsolebased application.
Note: Sometimes, when you create a java project over Eclipse Java IDE, Eclipse includes a file named "moduleinfo.java" to
your project. Make sure you delete this file to avoid compilation errors.
Task points: Attached with this assignment are CSV files with data for the three relations described above. Through your
Python or Java application, perform the following steps:
Connect with the your MyCompany database
Read the files line by line
Build SQL queries to insert the data records in the corresponding relation.
Note: After you run these insert queries successfully, you may check the content of the tables using MySQL workbenchshell
eg display the content of the tables
Note: To avoid inserting duplicate records and receiving errors, comment out eg this part in your Python or Java
code before you move to the next task.
Task points query Through your Python or Java application, use SQL to develop and execute the following queries:
For each available product vendor, display the vendor as well as the number of unique products and the total quantity
available. Only display vendors with more than unique products.
Display the customers by full name, state, and age who made orders with more than $ included
Display any order made in with total cost greater than the average of all orders made so far. Display the orders in
descending order of their total costs.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started