DAY 23-MySQL: Subqueries & Stored Procedures 10th July 24
Quiz
•
Professional Development
•
12th Grade
•
Practice Problem
•
Hard
KVCH CORPORATE
Used 6+ times
FREE Resource
Enhance your content in a minute
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which query retrieves the names of students who have enrolled in 'Mathematics' using a subquery?
SELECT name FROM students WHERE course = 'Mathematics';
SELECT name FROM students WHERE id IN (SELECT student_id FROM enrollments
WHERE course = 'Mathematics');
SELECT name FROM students WHERE id = (SELECT student_id FROM enrollments
WHERE course = 'Mathematics');
SELECT name FROM students WHERE course_id = (SELECT id FROM courses WHERE
name = 'Mathematics');
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which query creates a stored procedure named 'add_student' to insert a new student record?
CREATE PROCEDURE add_student (IN id INT, IN name VARCHAR(100), IN age INT)
BEGIN INSERT INTO students (id, name, age) VALUES (id, name, age); END;
CREATE PROCEDURE add_student (id INT, name VARCHAR(100), age INT) INSERT
INTO students (id, name, age) VALUES (id, name, age);
CREATE PROCEDURE add_student (IN id INT, name VARCHAR(100), age INT) INSERT
INTO students (id, name, age) VALUES (id, name, age);
CREATE PROCEDURE add_student (IN id INT, IN name VARCHAR(100), IN age INT)
INSERT INTO students (id, name, age) VALUES (id, name, age);
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which query uses a subquery to find the average age of students and retrieves names of students older than this average age?
SELECT name FROM students WHERE age > (SELECT AVG(age) FROM students);
SELECT name FROM students WHERE age >AVG(age);
SELECT name FROM students WHERE age >(SELECT AVERAGE(age) FROM students);
SELECT name FROM students WHERE age >(SELECT MEAN(age) FROM students);
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which query creates a stored procedure named 'get_student' to retrieve a student's details by their ID?
CREATE PROCEDURE get_student (IN student_id INT) SELECT * FROM students WHERE
id = student_id;
CREATE PROCEDURE get_student (IN student_id INT) BEGIN SELECT * FROM students
WHERE id = student_id; END;
CREATE PROCEDURE get_student (student_id INT) BEGIN SELECT * FROM students
WHERE id = student_id; END;
CREATE PROCEDURE get_student (IN student_id INT) SELECT * FROM students WHERE
id = student_id; END;
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which query uses a subquery to retrieve the highest age from the 'students' table and displays it?
SELECT MAX(age) FROM students;
SELECT age FROM students WHERE age = (SELECT MAX(age) FROM students);
SELECT age FROM students WHERE age IN (SELECT MAX(age) FROM students);
SELECT MAX(age) FROM (SELECT age FROM students);
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which query creates a stored procedure named 'delete_student' to delete a student record by their ID?
CREATE PROCEDURE delete_student (student_id INT) DELETE FROM students WHERE
id = student_id;
CREATE PROCEDURE delete_student (IN student_id INT) DELETE FROM students
WHERE id = student_id;
CREATE PROCEDURE delete_student (IN student_id INT) BEGIN DELETE FROM students
WHERE id = student_id; END;
CREATE PROCEDURE delete_student (IN student_id INT) BEGIN DELETE FROM students
WHERE id = student_id;
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which query uses a subquery to find all students enrolled in courses with 'Science' in their name?
SELECT name FROM students WHERE course LIKE '%Science%';
SELECT name FROM students WHERE id IN (SELECT student_id FROM enrollments
WHERE course_id IN (SELECT id FROM courses WHERE name LIKE '%Science%'));
SELECT name FROM students WHERE id IN (SELECT student_id FROM enrollments
WHERE course_id = (SELECT id FROM courses WHERE name LIKE '%Science'));
SELECT name FROM students WHERE id IN (SELECT student_id FROM enrollments
WHERE course_name LIKE '%Science%');
Create a free account and access millions of resources
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
15 questions
Matrices - 2 Types of Matrices
Quiz
•
12th Grade
10 questions
Resume Quiz
Quiz
•
8th - 12th Grade
12 questions
TLC Unit 6: Basics of Instruction
Quiz
•
9th Grade - Professio...
11 questions
Civil Air Patrol Uniform Lesson
Quiz
•
8th Grade - University
13 questions
Ballet
Quiz
•
6th Grade - University
10 questions
Close Reading
Quiz
•
KG - University
10 questions
Multiple Intelligences
Quiz
•
KG - 12th Grade
13 questions
The Communication Process
Quiz
•
7th - 12th Grade
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
