
MYSQL quiz4

Quiz
•
Computers
•
10th Grade
•
Hard
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
Similar Resources on Wayground
15 questions
JS SQL Reviewer

Quiz
•
10th Grade
15 questions
Web Design #3

Quiz
•
9th - 12th Grade
10 questions
من أنا؟

Quiz
•
10th Grade
7 questions
مراجعة HTML & CSS

Quiz
•
10th Grade
12 questions
Quiz PWPB XI RPL

Quiz
•
10th Grade
11 questions
مسابقة الاطار المضمن والنموذج

Quiz
•
9th - 12th Grade
14 questions
MOAC Excel 2016 Lesson 05

Quiz
•
8th - 12th Grade
14 questions
css revision

Quiz
•
10th Grade
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
10 questions
UPDATED FOREST Kindness 9-22

Lesson
•
9th - 12th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
20 questions
US Constitution Quiz

Quiz
•
11th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
20 questions
Analog vs Digital

Quiz
•
9th - 12th Grade
10 questions
Exploring Cybersecurity Techniques and Threats

Interactive video
•
6th - 10th Grade
10 questions
Understanding the Internet and Data Transmission

Interactive video
•
7th - 12th Grade