
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);
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
Leadership and Cultural Diversity
Flashcard
•
University
20 questions
Relative Clauses
Flashcard
•
University
14 questions
Office Management and Secretarial Practice
Flashcard
•
University
15 questions
Environmental Vocabulary Flashcards
Flashcard
•
University
12 questions
Kitchen Vocabulary no pictures
Flashcard
•
KG
15 questions
Readings in Philippine History
Flashcard
•
University
12 questions
TỪ VỰNG BÀI 1 (B1)
Flashcard
•
KG
15 questions
Oscar Wilde Flashcard
Flashcard
•
University - Professi...
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade