Skip to content

Instantly share code, notes, and snippets.

@nealfennimore
Last active August 29, 2015 13:56
Show Gist options
  • Save nealfennimore/9155906 to your computer and use it in GitHub Desktop.
Save nealfennimore/9155906 to your computer and use it in GitHub Desktop.
The New One

Solution for Challenge: SOLO CHALLENGE: Modeling a One to Many Database. Started 2014-02-08T19:19:41+00:00

Image

SELECT tweet FROM tweets WHERE user_id='user_id'
SELECT tweet FROM tweets WHERE user_id='user_id' AND creation_at >= '2014-01-05'
SELECT tweet FROM tweets JOIN user ON user.user_id=tweet.user_id WHERE user_name='user_name'
SELECT user_name FROM user JOIN tweet ON user.user_id=tweet.user_id WHERE tweet_id='tweet_id'
SELECT COUNT(friends_count) FROM user
SELECT friend_user_id FROM friends_count WHERE friends_user_id='friends_user_id'
INTEGER NULL MEDIUMTEXT 'NULL' MEDIUMTEXT NULL MEDIUMTEXT 'NULL' MEDIUMTEXT 'NULL' MEDIUMTEXT 'NULL' MEDIUMTEXT NULL MEDIUMTEXT 'NULL' MEDIUMTEXT 'NULL' MEDIUMTEXT 'NULL' MEDIUMTEXT 'NULL' INTEGER NULL INTEGER NULL DATETIME NULL DATETIME NULL user_id
INTEGER NULL MEDIUMTEXT(160) 'NULL' DATE NULL MEDIUMTEXT NULL tweet_id
INTEGER NULL friend_user_id
" Reflection - I wanted to make a triple join based on a friends user_id and THEN get the friends user information, while still remaining on the original user (if that makes sense?). I need to work on SQL queries a bit more in that regard. Learned about syntax highlighting as I had to resubmit this problem and was suggested to use markdown in the process!
@tannerwelsh
Copy link

Hey Neal, it doesn't look like you've fully completed this challenge. You're missing part 4) Reflect.

Also, could you please format the SQL queries so that it is clearer which query is answering which question? You can even format your SQL to look all pretty using syntax highlighting in GitHub Flavored Markdown.

Please make the necessary changes and re-submit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment