Created
February 18, 2015 08:05
-
-
Save SolomonHD/d53b106df6dbf9368a38 to your computer and use it in GitHub Desktop.
SQL Statements
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
#1 | |
SELECT * FROM authors WHERE email = "[email protected]" | |
#2 | |
SELECT * FROM authors ORDER BY created_at DESC LIMIT 1; | |
#3 | |
SELECT question_text, count(*) FROM questions GROUP BY question_type | |
#4 | |
SELECT response_text, count(*) FROM responses GROUP BY response_text ORDER BY count(*) DESC WHERE question id= X | |
#5 | |
SELECT email, title | |
FROM surveys LEFT JOIN authors | |
ON surveys.author_id = authors.id | |
#6 | |
SELECT name FROM authors LEFT JOIN surveys ON surveys.author_id = authors.id WHERE surveys.author_id IS NULL; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment