MYSQL quiz4

MYSQL quiz4

10th Grade

10 Qs

quiz-placeholder

Similar activities

Microsoft Excel

Microsoft Excel

10th Grade

10 Qs

SQL запросы

SQL запросы

10th Grade

10 Qs

HTML CSS

HTML CSS

10th - 12th Grade

15 Qs

Quiz Web Programming

Quiz Web Programming

10th - 12th Grade

10 Qs

Intro to Scratch 2

Intro to Scratch 2

KG - University

12 Qs

9.1 Databases Cambridge IGCSE 0478

9.1 Databases Cambridge IGCSE 0478

10th Grade - University

10 Qs

مراجعة عامة لامتحان المنتصف لمقرر تقن 105

مراجعة عامة لامتحان المنتصف لمقرر تقن 105

10th Grade

15 Qs

Programming Basics

Programming Basics

9th - 10th Grade

10 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?