Open
Conversation
added 4 commits
September 7, 2018 08:03
Stretch done Last question answered LAST SPRINT DONE!
JohnJustinn
reviewed
Sep 13, 2018
JohnJustinn
left a comment
There was a problem hiding this comment.
Thorough work showing mastery of the topic. Very impressive!
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
queries.sqlthat runs all of theCREATE TABLE,INSERT, andSELECTqueries, below.Details
Write
CREATE TABLEstatements for these relationships:1.
organization. This table should at least have column(s):name2.
channel. This table should at least have column(s):*
name3.
user. This table should at least have column(s):*
name4.
message. This table should have at least columns(s):Add additional foreign keys needed to the above tables, if any.
Add additional join tables needed, if any.
Write
INSERTqueries to add information to the database.1. One organization,
Lambda School2. Three users,
Alice,Bob, andChristina3. Two channels,
#generaland#random4. 10 messages (at least one per user, and at least one per channel).
5.
Aliceshould be in#generaland#random.6.
Bobshould be in#general.7.
Christinashould be in#random.Write
SELECTqueries to:1. List all organization
names.2. List all channel
names.3. List all channels in a specific organization by organization
name.4. List all messages in a specific channel by channel
name#generalinorder of
post_time, descending. (Hint:ORDER BY. Because yourINSERTs might have all taken place at the exact same time, this mightnot return meaningful results. But humor us with the
ORDER BYanyway.)5. List all channels to which user
Alicebelongs.6. List all users that belong to channel
#general.7. List all messages in all channels by user
Alice.8. List all messages in
#randomby userBob.9. List the count of messages across all channels per user. (Hint:
COUNT,GROUP BY.)10. The title of the user's name column should be
User Nameand the title ofthe count column should be
Message Count. (The SQLite commands.mode columnand.header onmight be useful here.)11. The user names should be listed in reverse alphabetical order.
Example:
What SQL keywords or concept would you use if you wanted to automatically
delete all messages by a user if that user were deleted from the
usertable?
[Stretch!] List the count of messages per user per channel.