Question
Consider a relational database for SpaceFace.com, a new social media site. The schemas of these relations (with primary key attributes underlined) are: User-schema = (user_id,
Consider a relational database for SpaceFace.com, a new social media site. The schemas of these relations (with primary key attributes underlined) are:
User-schema = (user_id, name,favorite_band_id)
Group-schema= (group_id, name, description, favorite_band_id)
Note-schema=(note_id, user_id, text)
BelongsTo-schema= (user_id, group_id, private)
InvitedTo-schema=(group_id,invitor_id,invitee_id)
Bands-schema= (band_id, name, genre)
Where:
Users can create notes, which are stored in the note relation. In addition, when a user joins agroup, a tuple is created in the belongsTo relation.
Relation Descriptions:
users lists all of the users of the site
group lists all of the groups on the site
note lists notes that a user all of the students of the college
belongsToindicates the group for which a user is a member
invitedToindicates pending invitations for a user
bands lists music bands
Attribute Descriptions:
user_id, group_id, note_id, and band_id are integers assigned to each user, group, and band, respectively
name is either the name of a user, group, or band (depending on the relation), and can be no more than 80 characters long
favorite_band_id is the band_id of a users or groups favorite band. Note that a user or group may not have a favority band.
invitor_id is the user_id of the person who invited someone to the group. This person must be a member of the group
invitee_id is the user_id of the person who has been invited to a group. This person will not yet be a member of the group.
description and text are strings of up to 255 characters
private is a variable that indicates whether the new members require an invitation from an existing member to join. Note that there is no Boolean domain in Oracle, so you can use char(1) instead.
Give SQL statements to create the six relations showed above.
Note:
List the statements in the order in which you would execute them.
Be sure to define appropriate primary keys and foreign key constraints.
Be sure to enforce as many of the constraints on the attributes as possible, given the constraints that we have discussed so far(not null, primary key, foreign key, unique, check).
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