SQL Foundations I Module 3

Write three queries using different SET operators

Only editable by group admins

  • Last updated November 13, 2017 at 4:52 PM
  • Evidence visible to public
Three queries shall demonstrate the different Set operators. Submit a link to show your work.

All posted evidence

Tweaked query 2 to return any year somebody was born or died

SELECT born FROM people
INTERSECT
SELECT died FROM people
ORDER BY died desc;
mpurnell1 About 7 years ago

Query 3

SELECT title FROM alt_titles
EXCEPT
SELECT title FROM movies
ORDER BY title desc;
mpurnell1 About 7 years ago

Query 2

SELECT peopleid FROM credits
INTERSECT
SELECT died FROM people
ORDER BY peopleid desc;
mpurnell1 About 7 years ago

Query 1 (SQLFiddle doesn't appear to like SET operators so I had to switch to the Konagora sandbox)

SELECT title FROM movies
UNION
SELECT title FROM alt_titles
ORDER BY title;
mpurnell1 About 7 years ago

Still working on sets, just wanted to get others in for credit/corrections

jmfisher About 7 years ago

This query shows all girl_names EXCEPT the ones that are also boy_names.

jaco About 8 years ago

Looks like the other SET operators work in Konagora! This query shows only the names where the girl_names and boy_names tables INTERSECT.

jaco About 8 years ago

Example of a UNION operator.

UNION works fine.

jaco About 8 years ago

No syntax errors.

jaco About 8 years ago

With my lack of success across phpmyadmin(MySQL), Konagora, and SQL Fiddle: I'm beginning to think that nothing supports these SET operators

jaco About 8 years ago

Uses UNION to combine information from an old backup with my current codebase.

jaco About 8 years ago