Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need your help with MySQL. I have been producing errors like below. -------------- /* Query 3 */ SELECT c.category_id, count(p.product_id) AS product_count, MAX(p.list_price) AS

I need your help with MySQL. I have been producing errors like below.

-------------- /* Query 3 */ SELECT c.category_id, count(p.product_id) AS product_count, MAX(p.list_price) AS most_expensive_product FROM category c, product p WHERE p.category_id = c.category_id --------------

ERROR 1140 (42000): In aggregated query without GROUP BY, expression #1 of SELECT list contains nonaggregated column 'bookstore.c.category_id'; this is incompatible with sql_mode=only_full_group_by -------------- /* Query 4 */ SELECT c.email_address, sum(o.item_price)*count(order_id) FROM customer c, orders o WHERE o.customer_id = c.customer_id GROUP BY c.email_address --------------

ERROR 1054 (42S22): Unknown column 'o.item_price' in 'field list' -------------- /* Query 9 */ Select vendor.vendor_id,category.category_id,count(product.product_id) as " number of products" , avg(list_price) as " Average price" from vendor inner join product on vendor.vendor_id = product.vendor_id inner join category on product.category_id = category.category_id group by product.product_id having count(product.product_id) >1 --------------

Empty set, 2 warnings (0.00 sec)

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

em ployee employee_id INT(4) store_id VARCHAR(3) first_name CHAR(25) last_name CHAR(25) product category category_id INT(4) orders order_id INT (4) customer id INT(4) ? employee-id INT(4) product_id INT(4) category_id INT (4) category-name VARCHAR(50) product-code VARCHAR(10) product-name VARCHAR (50) description TEXT list price DECIMAL (10,2) discount percent DECIMAL (10,2) date_added DATETIME vendor_id INT(4) store_id VARCHAR(3) order date DATETIME ? phone ?AR(12) vendor email VARCHAR(100) salary DECIMAL (10,2) ? mgr INT(4) Indexes ship_am ount DECIMAL (10,2) ? tax. amount DECIMAL(10,2) VENDOR_id INT(11) company_name CHAR(100) ship-date DATETIME ship_address_id INT(4) contact-name CHAR(25) ? contact fname CHAR (25) card type VARCHAR (50) card number CHAR(16) address VARCHAR(35) HHcity VARCHAR (35) card expires CHAR(7) billing_address id INT (11) state VARCHAR(2) zip VARCHAR(5) phone ?AR(12) fax CHAR (12) email VARCHAR (100) store or deritems item_id INT(4) order_id INT (4) store_id VARCHAR(3) Indexes store_zip CHAR(5) region,jd CHAR(1) region-nam e dHAR(25) @product-'d INT (4) item_price DECIMAL (10,2) discount amount DECIMAL (10,2) quantity INT (3) address customer customer_id INT (4) email_address VARCHAR(100) password VARCHAR(60) first name VARCHAR(60) Ht last name VARCHAR(60) shipping address_id INT (5) address_id INT(4) customer_id INT (4) administrators admin_ id INT (11) ? email-address VARCHAR(255) line 1 VARCHAR(60) ? line2 VARCHAR(60) ? city VARCHAR(40) state VARCHAR(2) zip-code VARCHAR( 10) Phone VARGAR(12) disabled TINYINT(1) + password VARCHAR (255) first_nam e VARCHAR(255) last_name VARCHAR (255) ? billing-address-'d lNT

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_2

Step: 3

blur-text-image_3

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

Oracle Database 19c DBA By Examples Installation And Administration

Authors: Ravinder Gupta

1st Edition

B09FC7TQJ6, 979-8469226970

More Books

Students also viewed these Databases questions

Question

1.who the father of Ayurveda? 2. Who the father of taxonomy?

Answered: 1 week ago

Question

Commen Name with scientific name Tiger - Wolf- Lion- Cat- Dog-

Answered: 1 week ago