DAY 23-MySQL: Subqueries & Stored Procedures 10th July 24
Quiz
•
Professional Development
•
12th Grade
•
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
10 questions
Homeroom Guidance Posttest
Quiz
•
4th - 12th Grade
13 questions
Majors, Minors and Concentrations
Quiz
•
8th - 12th Grade
10 questions
Coach Review
Quiz
•
KG - Professional Dev...
10 questions
Postgraduate Opportunities in ELT I Quiz
Quiz
•
12th Grade
10 questions
Stock Market Indices
Quiz
•
9th - 12th Grade
9 questions
Well-Being
Quiz
•
1st Grade - University
10 questions
Cultural Diversity
Quiz
•
10th Grade - University
10 questions
Google Apps for Education
Quiz
•
KG - University
Popular Resources on Wayground
20 questions
Halloween Trivia
Quiz
•
6th - 8th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
15 questions
Order of Operations
Quiz
•
5th Grade
20 questions
Halloween
Quiz
•
5th Grade
16 questions
Halloween
Quiz
•
3rd Grade
12 questions
It's The Great Pumpkin Charlie Brown
Quiz
•
1st - 5th Grade
20 questions
Possessive Nouns
Quiz
•
5th Grade
10 questions
Halloween Traditions and Origins
Interactive video
•
5th - 10th Grade
Discover more resources for Professional Development
20 questions
Halloween movies trivia
Quiz
•
7th - 12th Grade
15 questions
Halloween Characters
Quiz
•
7th - 12th Grade
10 questions
Halloween Movies Trivia
Quiz
•
5th Grade - University
11 questions
Halloween Trivia #2
Quiz
•
12th Grade
14 questions
Halloween Fun
Quiz
•
2nd - 12th Grade
8 questions
Veterans Day Quiz
Quiz
•
12th Grade
28 questions
Ser vs estar
Quiz
•
9th - 12th Grade
21 questions
Halloween & Math
Quiz
•
8th - 12th Grade
