Skip to content

Instantly share code, notes, and snippets.

@gsisko
Last active January 27, 2021 06:21
Show Gist options
  • Save gsisko/1700e90c23832c3eeaf8814534c19d0c to your computer and use it in GitHub Desktop.
Save gsisko/1700e90c23832c3eeaf8814534c19d0c to your computer and use it in GitHub Desktop.
SQL Queries for ADP interview questions
#Show Mariopa County Database
SELECT * FROM maricopa;
#Show Pima County Database
SELECT * FROM pima;
#Combine Maricopa and Pima databases
SELECT maricopa_id AS cumulative_id, party, age, gender FROM maricopa
UNION
SELECT pima_id as cumulative_id, party, age, gender FROM pima;
#Show everyone in the state Database (SoS)
SELECT * FROM state;
#Find number of Democrats
SELECT COUNT(party) AS Dems FROM state
WHERE party='D';
#Find number of repulicans
SELECT COUNT(party) AS Reps FROM state
WHERE party='R';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment