Database Design & Development SQL 2
Quiz
•
Computers
•
University
•
Practice Problem
•
Hard
Nicole Donnelly
Used 3+ times
FREE Resource
Enhance your content in a minute
12 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Given the tables "students" with columns "student_id", "name", and "grade", and "courses" with columns "course_id", "student_id", and "course_name", which SQL statement retrieves the names of students who are enrolled in at least one course?
SELECT name FROM students WHERE student_id IN (SELECT student_id FROM courses);
SELECT name FROM students JOIN courses ON students.student_id = courses.student_id;
SELECT name FROM students, courses WHERE students.student_id = courses.student_id;
SELECT name FROM students WHERE EXISTS (SELECT student_id FROM courses WHERE students.student_id = courses.student_id);
2.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
How would you write a query to find the second highest salary from a table named "employees" with a column "salary"?
SELECT MAX(salary) FROM employees WHERE salary (SELECT AVG(price) FROM products);
SELECT product_name FROM products WHERE price > ALL (SELECT AVG(price) FROM products);
SELECT product_name FROM products WHERE price > MAX(price);
SELECT product_name FROM products WHERE price > (SELECT TOTAL(price) FROM products);
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
In a table "employees" with columns "employee_id", "name", and "manager_id", which SQL query retrieves the names of employees who do not have a manager?
SELECT name FROM employees WHERE manager_id IS NULL;
SELECT name FROM employees WHERE manager_id = 0;
SELECT name FROM employees WHERE manager_id = '';
SELECT name FROM employees WHERE manager_id IS NOT NULL;
4.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which SQL statement retrieves the top 3 highest salaries from a table "salaries" with a column "amount"?
SELECT amount FROM salaries ORDER BY amount DESC LIMIT 3;
SELECT TOP 3 amount FROM salaries ORDER BY amount DESC;
SELECT amount FROM salaries WHERE amount IN (SELECT amount FROM salaries ORDER BY amount DESC LIMIT 3);
SELECT amount FROM salaries ORDER BY amount DESC FETCH FIRST 3 ROWS ONLY;
5.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
In a table "sales" with columns "sale_id", "product_id", and "sale_date", which SQL statement finds the most recent sale date?
SELECT MAX(sale_date) FROM sales;
SELECT sale_date FROM sales ORDER BY sale_date DESC LIMIT 1;
SELECT TOP 1 sale_date FROM sales ORDER BY sale_date DESC;
SELECT sale_date FROM sales WHERE sale_date = (SELECT MAX(sale_date) FROM sales);
6.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
How would you write a query to find all customers who have placed more than 5 orders from a table "orders" with columns "order_id" and "customer_id"?
SELECT customer_id FROM orders GROUP BY customer_id HAVING COUNT(order_id) > 5;
SELECT customer_id FROM orders WHERE COUNT(order_id) > 5;
SELECT customer_id FROM orders WHERE order_id > 5;
SELECT customer_id FROM orders GROUP BY customer_id HAVING COUNT(DISTINCT order_id) > 5;
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Given a table "inventory" with columns "item_id", "item_name", and "quantity", which SQL statement updates the quantity of all items to zero?
UPDATE inventory SET quantity = 0;
UPDATE inventory SET quantity = '0';
UPDATE inventory SET quantity TO 0;
UPDATE inventory SET quantity = NULL;
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
10 questions
ITESA Roadmap Event 12-09-24
Quiz
•
University
13 questions
Week 2 Before Class
Quiz
•
University
10 questions
Recursion Practice, Recursion Practice, Recursion Practice...
Quiz
•
10th Grade - University
17 questions
Email Lớp 6
Quiz
•
6th Grade - University
10 questions
CHAPTER 1: COMPUTER SECURITY REVIEW
Quiz
•
University
10 questions
CP N5 Theory Test 1
Quiz
•
University
10 questions
Introduction to AI - Healthcare & Business
Quiz
•
University - Professi...
10 questions
Perkakasan Multimedia
Quiz
•
University
Popular Resources on Wayground
5 questions
This is not a...winter edition (Drawing game)
Quiz
•
1st - 5th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
10 questions
Identify Iconic Christmas Movie Scenes
Interactive video
•
6th - 10th Grade
20 questions
Christmas Trivia
Quiz
•
6th - 8th Grade
18 questions
Kids Christmas Trivia
Quiz
•
KG - 5th Grade
11 questions
How well do you know your Christmas Characters?
Lesson
•
3rd Grade
14 questions
Christmas Trivia
Quiz
•
5th Grade
20 questions
How the Grinch Stole Christmas
Quiz
•
5th Grade
Discover more resources for Computers
26 questions
Christmas Movie Trivia
Lesson
•
8th Grade - Professio...
20 questions
christmas songs
Quiz
•
KG - University
20 questions
Holiday Trivia
Quiz
•
9th Grade - University
15 questions
Holiday Movies
Quiz
•
University
14 questions
Christmas Trivia
Quiz
•
3rd Grade - University
20 questions
Christmas Trivia
Quiz
•
University
8 questions
5th, Unit 4, Lesson 8
Lesson
•
KG - Professional Dev...
20 questions
Disney Trivia
Quiz
•
University
