Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Given the following relational database schema: Users ( uid , name, school, year, age ) Friends ( uid 1 , uid 2 ) Foreign key
Given the following relational database schema: Usersuid name, school, year, age
Friendsuid uid
Foreign keyuid references Usersuid Foreign keyuid references Usersuid
Postspid uid, text, datetime, rating
Foreign keyuid references Usersuid
Likesuid pid, datetime
Foreign keyuid references Usersuid Foreign keypid references Postspid
Write SQL commands to achieve each of the following requests points for each:
Retrieve each post text and the name of the user who has posted it
Retrieve the text of each post that has been posted by any person who is enrolled at UTD school
Retrieve the names of all the friends of the user John Smith
Retrieve the name of each user if heshe has posted any text that talks about UTD
Retrieve the name of user who does not have any post.
Retrieve the name of each user and the number of friends heshe has.
Retrieve the names of the users who has the maximum number of posts.
Remove every fact that indicates that the user with the name John Smith likes posts that were posted by the user whose name is Tom Harper
Increase the rating by for every post that has been posted by any user whose age is more than
Prevent any user of age below from posting any text.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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