Task:
Let us consider the following relational
is denoted by an underline. The foreign keys are italicized.
Schema:
▪ Customers (custID, fName, lName, password)
▪ Phones (custID, phone)
▪ Items (iID, name, price, qtyInStock)
▪ OrdersPlaces (oID, ordDate, shippingDate, receivalDate receivalDate, payMethod,
custID)
▪ Contains (oID, iID, price, qty)
Specifically, the foreign keys for this database are as follows:
• the column custID of relation Phones that references table Customers,
• the column custID of relation OrdersPlaces that references table Customers,
• the column oID of relation Contains references table OrdersPlaces, and
• the column iID of relation Contains references table Items,
Assignment Submission Instructions:
This is an individual assignment – no group submissions are allowed. Submit a script file that
contains the SELECT statements by assigned date. The outline of the script file lists as follows:
/* ********************************************************************************
* Name: YourNameGoesHere *
* Class: CST 235 *
* Section: *
* Date: *
* I have not received or given help on this assignment: YourName *
***********************************************************************************/
USE RetailDB;
####### Tasks: Write SQL Queries #########
-- Task 1 (Customer Information):
-- List your SELECT statement below.
-- Task 2 (Inventory Control):
-- List your SELECT statement below.
-- Task 3 (Monthly Sale Information):
-- List your SELECT statement below.
-- Task 4 (Monthly Sale Analysis):
-- List your SELECT statement below.
-- Task 5 (Frequent purchasing customers):
-- List your SELECT statement below.
Make sure the SQL script file can be run successfully in MySQL and show the outcome of the code on MySQL
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 5 images
- Task 1:Create a database Entity and Relationship Diagram (ERD) for the following application:Please include answer with detailed explanationKhair Application: The Application idea: It is a mobile application called (Khair) to help people. This assistance is moral, material. This assistance is also provided by good people in our community. Example to understand the Application idea more: For example, a person urgently needs a medical chair or bed and does not have the ability to purchase what he needs. The medical chair or bed is requested through the application, and whoever has what he requests initiates the request through the application’s messages and determines the meeting place. Application models (page): Login included: login registration login included: user name password New registration included: name E-mail Password phone number date National Identification Number Home page included: Request - applicant name - address - send message Messages list form included: list of…arrow_forwardThe database used for this question is a very simple one with the following schema: (Primary keys are bold, foreign keys are underlined) CUSTOMER (CustID, FirstName, LastName, City, Phone, Email) INVOICE (InvoiceNumber, CustID, Date) INVOICE_ITEM(InvoiceNumber, ItemNumber, Quantity) ITEM (ItemNumber, ItemName, UnitPrice) When a customer makes a purchase, an invoice is created. The invoice may be for many items. For example, in a single purchase, a customer might buy 10 Back Scratchers, 4 Hair Removers and a Dog Lead. Provide relational algebra (NOT SQL) queries to find the following information. NOTE: You can use the symbols s, P, etc., or the words’ PROJECT’, ‘RESTRICT’ etc. as you prefer. You do not need to try to make efficient queries – just correct ones. Where you use a join, always show the join condition. List the dates on which Homer Griffin made purchases. List the first and last names of customers who have bought “Back Scratcher” or “Hair Remover” List the first…arrow_forwardThe following three tables make up a simple reservation system for a small campground. The database should allow for a camper to make multiple reservations for future dates and for a camping spot to have several reservations for upcoming visits. Table: Camper CAMPER_NUMBER 1000 1001 1002 1003 CAMPER_LAST_NAME Jones Schmidt Williams Cooper CAMPER_FIRST_NAME Jamie Pat Clifford Amanda CAMPER_ADDRESS 1278 Essex Pl 4954 Spangled Way 956 Segull Lane P. O. Box 998877 CAMPER_CITY Birmingham El Paso Portland Portsmouth CAMPER_STATE AL TX ME OH CAMPER_ZIP_CODE 45251 79919 4108 45662 CAMPER_DRIVERS_LICENSE JJ998743-98 87632434 WIL885123 765A876B897 CAMPER_EMAIL jjones@somewhere.com patwonderfu34l@nowhere.net williams98342@foomail.com coopera@nowhere.net Table: Spot SPOT_NUMBER 101 102 103 104 SPOT_NAME The Pines The Glade Teardrop Spot Tent In Trees…arrow_forward
- Task:Let us consider the following relational database. The primary key column(s) of each table is denoted by an underline. The foreign keys are italicized.Schema:▪ Customers (custID, fName, lName, password)▪ Phones (custID, phone)▪ Items (iID, name, price, qtyInStock)▪ OrdersPlaces (oID, ordDate, shippingDate, receivalDate payAmount, payMethod, custID)▪ Contain (oID, iID, price, qty)Specifically, the foreign keys for this database are as follows:• the column custID of relation Phones that references table Customers, • the column custID of relation OrdersPlaces that references table Customers, • the column oID of relation Contain references table OrdersPlaces, and• the column iID of relation Contain references table Items, This is an individual assignment – no group submissions are allowed. Submit a script file that contains the SELECT statements by assigned date. The outline of the script file lists as follows:/*…arrow_forwardConsider the following schema of hotel reservations database: Hotel (Hotel No, Name, City) Room (Room No, Hotel No, Type, Price) Booking (Hotel No, Guest No, Date From, Date_To, Room No) Guest (Guest_No, Name, City) Write RA queries for the following: a) Get the details (names and price) of all hotels in California. b) Get the average price of a room grouped by city. c) Find the hotel name and city of the hotel with the highest priced room. d) Get the hotel names and room numbers of any hotel rooms that have not been booked.arrow_forwardThe following database is maintained by a bookstore: the database structure is shown below. AUTHOR(AuthorName) BOOK(ISBN, AuthorName, Title, PublisherName, PublicationYear, RetailPrice)AuthorName foreign key to AUTHORPublisherName foreign key to PUBLISHER PUBLISHER(PublisherName) CUSTOMER(CustomerNumber, Name, Address, Phone, Email, CreditCardNumber, ExpiryDate) ORDER(OrderNumber, CustomerNumber, OrderDate)CustomerNumber foreign key to CUSTOMER ORDERDETAIL(OrderNumber, ISBN, QuantitySold, RetailPrice, TotalCost)OrderNumber foreign key to ORDER Write SQL code to implement the following separate queries numbered 1 to 4: 1. Find all orders placed in 2018-2019. 2. Report the following information: ISBN, AuthorName, Title, RetailPrice for all books written byAlexandre Dumas or by Mark Twain, published by ClassicsPublishingCo, with a retail price at least$24.99. 3. Create a table which shows the value of orders by each customer who actually placed an orderin 2019. Group in order by customer…arrow_forward
- Create the following tables in your database with the following schema: Table: Employee | Column Name | Type | empId I name | supervisor | salary | int | varchar | | int | int empId is the primary key column for this table. Each row of this table indicates the name and the ID of an employee in addition to their salary and the id of their manager. Table: Bonus | Column Name | Type | | empId | bonus | int | int empId is the primary key column for this table. empId is a foreign key to empId from the Employee table. Each row of this table contains the id of an employee and their respective bonus. Add the following data to your tables: Input: Employee table: | empId | name | supervisor | salary | | 3 | Brad | null | 4000 | 1000 | 2000 | 4000 | John | 3 | 2 | 4 | Dan | 3 | Thomas | 3arrow_forwardBy skipping columns that don't fit certain requirements, a select operation may drastically shrink a table's footprint in a relational database.Should I believe it or not?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