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
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?
Similar Resources on Wayground
14 questions
Petit Fours
Quiz
•
12th Grade - University
15 questions
The Bhutan Baccalaureate
Quiz
•
8th Grade - University
15 questions
Work Immersion Quiz 1-3
Quiz
•
12th Grade
13 questions
ทดสอบก่อนเรียนพื้นฐานการเขียนโปรแกรมคอมพิวเตอร์
Quiz
•
9th - 12th Grade
14 questions
PLC-3 of 21st century skills
Quiz
•
12th Grade
15 questions
Lesson Planning Lingo
Quiz
•
KG - 12th Grade
10 questions
MINT Quizizz Breakout Room Review for New Teachers
Quiz
•
KG - 12th Grade
7 questions
Six Pillars of Character
Quiz
•
KG - University
Popular Resources on Wayground
10 questions
Honoring the Significance of Veterans Day
Interactive video
•
6th - 10th Grade
9 questions
FOREST Community of Caring
Lesson
•
1st - 5th Grade
10 questions
Exploring Veterans Day: Facts and Celebrations for Kids
Interactive video
•
6th - 10th Grade
19 questions
Veterans Day
Quiz
•
5th Grade
14 questions
General Technology Use Quiz
Quiz
•
8th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
15 questions
Circuits, Light Energy, and Forces
Quiz
•
5th Grade
19 questions
Thanksgiving Trivia
Quiz
•
6th Grade
Discover more resources for Professional Development
28 questions
Ser vs estar
Quiz
•
9th - 12th Grade
34 questions
Geometric Terms
Quiz
•
9th - 12th Grade
20 questions
-AR -ER -IR present tense
Quiz
•
10th - 12th Grade
16 questions
Proportional Relationships And Constant Of Proportionality
Quiz
•
7th - 12th Grade
10 questions
DNA Replication Concepts and Mechanisms
Interactive video
•
7th - 12th Grade
10 questions
Unit 2: LS.Bio.1.5-LS.Bio.2.2 Power Vocab
Quiz
•
9th - 12th Grade
20 questions
Food Chains and Food Webs
Quiz
•
7th - 12th Grade
15 questions
Identify Triangle Congruence Criteria
Quiz
•
9th - 12th Grade
