MYSQL quiz4

MYSQL quiz4

10th Grade

10 Qs

quiz-placeholder

Similar activities

Excel Formula

Excel Formula

10th Grade

15 Qs

mysql-Statements

mysql-Statements

10th Grade

14 Qs

MOAC Excel 2016 Lesson 09

MOAC Excel 2016 Lesson 09

8th - 12th Grade

10 Qs

Web 1: Types of selectors

Web 1: Types of selectors

9th - 12th Grade

10 Qs

SQL - 03 - Update...

SQL - 03 - Update...

10th Grade

12 Qs

ITAA unit 4: CSS Layout

ITAA unit 4: CSS Layout

9th - 12th Grade

7 Qs

If-Statements

If-Statements

9th - 12th Grade

10 Qs

2TR SQL - 06 -  IN, BETWEEN, EXAMPLES

2TR SQL - 06 - IN, BETWEEN, EXAMPLES

10th Grade

8 Qs

MYSQL quiz4

MYSQL quiz4

Assessment

Quiz

Computers

10th Grade

Hard

Created by

Symbat Ishanova

FREE Resource

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Retrieve the number of customers in each city who have made more than 5 orders.


SELECT city, COUNT(customer_id) AS num_customers FROM orders GROUP BY city HAVING COUNT(customer_id) > 5;


SELECT city, COUNT(customer_id) AS num_customers FROM orders GROUP BY city WHERE COUNT(customer_id) > 5;


SELECT city, COUNT(customer_id) AS num_customers FROM orders HAVING COUNT(customer_id) > 5 GROUP BY city;


 SELECT city, COUNT(customer_id) AS num_customers FROM orders WHERE COUNT(customer_id) > 5 GROUP BY city;


2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Retrieve the average salary of employees in each department that have more than 10 employees.


SELECT department, AVG(salary) AS avg_salary FROM employees GROUP BY department WHERE COUNT(*) > 10;


SELECT department, AVG(salary) AS avg_salary FROM employees GROUP BY department HAVING COUNT(*) > 10;


SELECT department, AVG(salary) AS avg_salary FROM employees HAVING COUNT(*) > 10 GROUP BY department;


SELECT department, AVG(salary) AS avg_salary FROM employees WHERE COUNT(*) > 10 GROUP BY department;


3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Retrieve the maximum order amount for each customer who has placed more than 3 orders.


 SELECT customer_id, MAX(order_amount) AS max_amount FROM orders GROUP BY customer_id WHERE COUNT(*) > 3;


SELECT customer_id, MAX(order_amount) AS max_amount FROM orders HAVING COUNT(*) > 3 GROUP BY customer_id;


SELECT customer_id, MAX(order_amount) AS max_amount FROM orders GROUP BY customer_id HAVING COUNT(*) > 3;


 SELECT customer_id, MAX(order_amount) AS max_amount FROM orders WHERE COUNT(*) > 3 GROUP BY customer_id;


4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Retrieve the total quantity of products sold for each category where the average price is greater than $50.


SELECT category, SUM(quantity) AS total_quantity FROM products WHERE AVG(price) > 50 GROUP BY category;


SELECT category, SUM(quantity) AS total_quantity FROM products HAVING AVG(price) > 50 GROUP BY category;


SELECT category, SUM(quantity) AS total_quantity FROM products GROUP BY category WHERE AVG(price) > 50;


SELECT category, SUM(quantity) AS total_quantity FROM products GROUP BY category HAVING AVG(price) > 50;


5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Retrieve the minimum age of employees in each department who have more than 5 years of experience.


SELECT department, MIN(age) AS min_age FROM employees GROUP BY department HAVING COUNT(*) > 5 AND experience > 5;


 SELECT department, MIN(age) AS min_age FROM employees GROUP BY department WHERE COUNT(*) > 5 AND experience > 5;


SELECT department, MIN(age) AS min_age FROM employees HAVING COUNT(*) > 5 AND experience > 5 GROUP BY department;


SELECT department, MIN(age) AS min_age FROM employees WHERE COUNT(*) > 5

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Retrieve the number of customers in each city who have made more than 5 orders.


SELECT city, COUNTCOUNT(customer_id) > 5;


SELECT city, COUNT(customer_id) AS num_customers FROM orders GROUP BY city HAVING COUNT(customer_id) > 5;


SELECT city, COUNT(customer_id) AS num_customers FROM orders HAVING COUNT(customer_id) > 5 GROUP BY city;


 SELECT city, COUNT(customer_id) AS num_customers FROM orders WHERE COUNT(customer_id) > 5 GROUP BY city;


7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the main purpose of a database?


To organize and store data


To analyze trends and derive insights


To encrypt sensitive information


To manage concurrent access and updates


Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?