Question: 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
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
