Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You are creating a data model for local coffee shops. For each of the following attributes, provide an appropriate datatype and justification for your
You are creating a data model for local coffee shops. For each of the following attributes, provide an appropriate datatype and justification for your choice. Include a field size where applicable. Data type Justification Attribute shop_id shop_name owner_name street city state zipcode latlong date_opened has_decaf 2. (5 pt) Using the coffee shop data model from above, let's say we also want to model people who buy coffee. Is a hierarchical relationship between people and coffee shops appropriate for this? Why or why not? 3. (5 pt) Represent the content of the following JSON file in one or more tables. { 1 2 4 5 7 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 "Course": [{ "number": "INFO201", "name": "Foundational Skills for Data Science", "credits": 5, "Offering": [ ] "number": "INFO330", name": "credits": 5, "Offering" : [ 1 {"quarter": "AUT2022", "instructor": "Hendry"}, {"quarter": "WIN2023", "instructor": "Walsh"} First schema Given this schema: "number": "INFO360", "name": "Design Methods", "credits": 4, "offering" : [ {"quarter": "WIN2023", "instructor": "Kotut"). bases & Data Modeling", ("quarter": "SPR2022", "instructor": "Boiko"}, {"quarter": "AUT2022", "instructor": "Hay"), {"quarter": "WIN2023", "instructor": "Wang"} Users(uID, username, joinedTime, city) Posts(pID, uID, postTime, postText) Likes(uID, PID, likeTime) Posts[UID] Users [UID] Likes [UID] Users[UID] Likes [pID] C Posts [pID] Solve all queries below using only select (o), project (II), Cartesian product (x), natural join (), and the assignment operator (:=). 4. (5 pt) Write a query that finds the usernames for all users in Seattle. 5. (5 pt) Write a query that finds all text posted by users in Seattle. 2 6. (10 pt) Write a query that finds all IDs of posts that have been posted by users in Seattle and liked by users in Portland. This question combines lots of opera- tions; try to break down what you need to do step by step, write the component pieces, and then combine them together. Toy database schema Connect to our class server and use the toy database. 7. (5 pt) Write out a schema based on the attributes in the books, ratings, and users tables. In pgAdmin, you can find the attributes under Schemas Tables Columns. Some information about these attributes: The 'id' attribute in all three tables is different! You can think of them in your mind as the "book_id', 'user_id', and 'rating_id'. . The 'title' attribute in the Books table is the same as the 'book_name' attribute in the Ratings table. . The 'id' attribute in the Users table is the same as the 'user_id' attribute in the Ratings table. With this information in mind, please solve all queries below using only select (o), project (II), Cartesian product (x), natural join (), sort (7), and the assignment oper- ator (:=). 8. (5 pt) Write a query to list all book titles rated by user "LibreLibrary". BONUS: (5 pt) Write a query to list all book titles that have a 4 or higher GoodReads rating that have been rated by user "LibreLibrary" sorted by "LibreLibrary's rating. 3
Step by Step Solution
★★★★★
3.48 Rating (158 Votes )
There are 3 Steps involved in it
Step: 1
It looks like you have a series of questions related to database design and SQL queries Lets address each question one by one First for the coffee shop data model Attribute Data type Justification sho...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started