Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

MySQL SQL COUNT() A sql-6-6.sql file has been opened for you. Write each of the

ID: 3905082 • Letter: M

Question

MySQL

SQL COUNT()

A sql-6-6.sql file has been opened for you.

Write each of the following tasks as a SQL statement in a new line (remember that you can source the file to compare the output reference):

1 - Use the e_store database

2 - Select the total amount of products in the products table. Alias the column name as total_product_count. The resulting table should look like this:

3 - Select the total stars field count of the product with id= 4. Alias the column name as stars_fields_count. The resulting table should look like this:

Explanation / Answer

Question 1:

USE e_store;

Question 2:

SELECT COUNT(amount) as total_product_count
FROM products;

Question 3:

SELECT id,COUNT(stars) as stars_fields_count
FROM products
WHERE id = 4;