
SQL Subqueries
Flashcard
•
Computers
•
University
•
Practice Problem
•
Hard
Riddhish Thakore
Used 1+ times
FREE Resource
Student preview

19 questions
Show all answers
1.
FLASHCARD QUESTION
Front
What SQL query retrieves employees working in companies located in Hyderabad?
Back
SELECT ename FROM employee e WHERE EXISTS (SELECT 1 FROM company c JOIN city ct ON c.lid = ct.lid WHERE c.cid = e.cid AND ct.lname = 'Hyderabad');
2.
FLASHCARD QUESTION
Front
How can you find companies that have at least one employee?
Back
SELECT cname FROM company c WHERE EXISTS (SELECT 1 FROM employee e WHERE e.cid = c.cid);
3.
FLASHCARD QUESTION
Front
What is the SQL query to get employees working for companies located in cities with more than one company?
Back
SELECT ename FROM employee e WHERE EXISTS (SELECT 1 FROM company c1 WHERE c1.cid = e.cid AND EXISTS (SELECT 1 FROM company c2 WHERE c1.lid = c2.lid AND c1.cid <> c2.cid));
4.
FLASHCARD QUESTION
Front
How do you find cities that have employees working in any company located there?
Back
SELECT lname FROM city ct WHERE EXISTS (SELECT 1 FROM company c JOIN employee e ON c.cid = e.cid WHERE c.lid = ct.lid);
5.
FLASHCARD QUESTION
Front
What query retrieves employees not assigned to any company?
Back
SELECT ename FROM employee e WHERE NOT EXISTS (SELECT 1 FROM company c WHERE c.cid = e.cid);
6.
FLASHCARD QUESTION
Front
How can you find companies that don’t have any employees?
Back
SELECT cname FROM company c WHERE NOT EXISTS (SELECT 1 FROM employee e WHERE e.cid = c.cid);
7.
FLASHCARD QUESTION
Front
What is the SQL query to get cities with no companies?
Back
SELECT lname FROM city ct WHERE NOT EXISTS (SELECT 1 FROM company c WHERE c.lid = ct.lid);
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
10 questions
Philippine History
Flashcard
•
12th Grade - University
9 questions
Special Places
Flashcard
•
KG - University
10 questions
“VIVO MI CULTURA Y SIGO CONSTRUYENDO MI IDENTIDAD (INTERCULTURA
Flashcard
•
12th Grade
8 questions
All Things Print!
Flashcard
•
KG - University
11 questions
Fundamentals of Cryptography
Flashcard
•
University
14 questions
Power Vocabulary
Flashcard
•
University
13 questions
Key Work Related Attitudes
Flashcard
•
University
12 questions
Mare Paula
Flashcard
•
KG - University
Popular Resources on Wayground
5 questions
This is not a...winter edition (Drawing game)
Quiz
•
1st - 5th Grade
15 questions
4:3 Model Multiplication of Decimals by Whole Numbers
Quiz
•
5th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
10 questions
The Best Christmas Pageant Ever Chapters 1 & 2
Quiz
•
4th Grade
12 questions
Unit 4 Review Day
Quiz
•
3rd 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
Discover more resources for Computers
26 questions
Christmas Movie Trivia
Lesson
•
8th Grade - Professio...
7 questions
Different Types of Energy
Interactive video
•
4th Grade - University
20 questions
Slopes and Slope-Intercept Form
Quiz
•
8th Grade - University
7 questions
Force and Motion
Interactive video
•
4th Grade - University
7 questions
Biomolecules (Updated)
Interactive video
•
11th Grade - University
20 questions
Winter/Holiday Trivia
Quiz
•
KG - University
10 questions
WINTER WIN Time - ELA - 12/9/2025
Quiz
•
KG - University
7 questions
Human Impact on Resources
Interactive video
•
4th Grade - University