Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MySQL on MySQL work bench ~ /*1. Select the average mpg city and the average fuel cost annually, grouped by fuel type. Return the rows

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

MySQL on MySQL work bench

~ /*1. Select the average mpg city and the average fuel cost annually, grouped by fuel type. Return the rows with the best mpg city first. Paste the SQL below. O /*2. Delete all of the records from the vehicle table that list a vehicle that has only 3 cylinders. Remember, to comply with your foreign key constraints, you must delete any related records in the uservehicle table first (leave no orphans). Paste the SQL statements below. */ ~ /*3. Create a function that accepts an itemId as input and returns the number of items in stock. Paste the create function SQL below. */ /*4. Create a function that accepts an orderId as input and returns the sum total price of all items on that order multiplied by the quantity ordered. Paste the create function SQL below. /*5. Create a stored procedure that accepts a userId and returns the user's full name, occupation, the count to all orders they placed, the number of DVDs they own, and the number of vehicles they own. Paste the create procedure SQL below. ol perform the task. activitylog activityLogid INT(11) activitate DATETIME activityText VARCHAR(1000) userId VARCHAR(50) orderId INT(11) users userid VAROIAR(50) firstime VARCHAR(100) Olestrame VARCHAR(100) middleName VARCHAR(100) username VARCHAR(20) password VARCHAR (20) dob DATE gender CHAR(1) occupationId INT (11) userStatusid INT (11) userTypeld INT(11) created DATETIME Indexes orders ordeid INT(11) usertd VARCHAR(50) order Date DATETIME shipping ate DATETIME Index dud dvdd INT(11) DVD_Tie VARCHAR(255) Studio VARCHAR(255) Released VARCHAR(255) Status VARCHAR(255) Sound VARDAAR(255) Versions VARCHAR(255) Price VARCHAR(255) Rating VARCHAR(255) Year VARCHAR(255) Genre VARCHAR(255) Aspect VAROHAR (255) UPC VARCHAR(255) DVD_Release Date VARCHAR(255) createdDate VARCHAR(255) publicating DECIMAL (42) Indexes vehicle vehided INT (11) make VAROLAR (255) model VARCHAR(255) year INT(11) cyinders INT (11) displacement VARCHAR(255) drive VARCHAR(255) enold INT(11) eng_dscr VARCHAR(255) trany VARCHAR(255) mphighway VARCHAR(255) mpgCity VARCHAR(255) fud CostAnnual INT (11) fuel Type VARCHAR(255) fue Type 1 VARCHAR(255) das VARCHAR(255) Indexes orderitem orderId INT(11) temid INT (11) OU quantity INT (11) + Y item itemId INT (11) temName VARCHAR(100) itemPrice DECIMAL (10,2) primaryimage VARCHAR(50) item Category VARCHAR(50) Indexes Indexes uservehide userVehield INT (11) userid VARCHAR(50) vehidleid INT (11) vehicle vehideld INT (11) make VARCHAR(255) model VARCHAR(255) year INT(11) cylinders INT (11) displacement VARCHAR(255) drive VAROHAR (255) engid INT(11) eng dsce VARCHAR (255) trany VARCHAR(255) mp Highway VARCHAR(255) mpgCity VARCHAR(255) fuel Cost Annual INT (11) fueType VARCHAR (255) fuel Type I VARCHAR(255) OVO VARCHAR(255) occupation occupationId INT (11) Occupation VARCHAR(250) " users ?userid VAROLAR (SO) frstrane VARCHAR(100) lastname VARCHAR(100) middleName VARCHAR(100) username VARCHAR(20) password VARCHAR(20) dob DATE gender CHAR(1) OccupationId INT (11) userStatusid INT (11) userTypeid INT(11) created DATETIME Index item Piemid INT (11) itemName VARCHAR(100) itemPrice DEOMA (10,2) primary&mage VARCHAR(50) item Category VARCHAR(50) dvd dvold INT(11) DVD_Tide VARCHAR(255) Studio VARCHAR(255) Released VARCHAR(255) Status VARCHAR(255) Sound VARCHAR(255) Versions VARCHAR(255) userdvd user Dvdid INT(11) user VARCHAR(90) dvdld INT (11) Price VARCHAR(255) OR VARCHAR(255) orderitem orderd INT(11) Oteld INT (11) quantity INT (11 Indexes orders orderid INT(11) userid VARCHAR(50) order Date DATETIME shippingDe DATETIME Year VARCHAR(255) Genre VARCHAR(255) Aspect VARCHAR(255) UPC VAROHAR(255) DVD Release Date VARCHAR(255) created VAROHAR (255) publicating DECIMAL (42) Tahles used in this exercise

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Reliability Engineering Designing And Operating Resilient Database Systems

Authors: Laine Campbell, Charity Majors

1st Edition

978-1491925942

More Books

Students also viewed these Databases questions

Question

Define Decision making

Answered: 1 week ago

Question

What are the major social responsibilities of business managers ?

Answered: 1 week ago

Question

What are the skills of management ?

Answered: 1 week ago