Last active
January 27, 2021 06:21
-
-
Save gsisko/1700e90c23832c3eeaf8814534c19d0c to your computer and use it in GitHub Desktop.
SQL Queries for ADP interview questions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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