2021-03-16

Mar 17 In-Class Exercise.

Please post your solution to the Mar 17 In-Class Exercise to this thread.
Best,
Chris
Please post your solution to the Mar 17 In-Class Exercise to this thread. Best, Chris
2021-03-17

-- Mar 17 In-Class Exercise
USER(USERID, USERNAME, EMAIL, PASSWORD)
POST(POSTID, USERID, POST_TEXT, LIKES)
USERID → USERNAME, EMAIL, PASSWORD
POSTID → USERID, POST_TEXT, LIKES
It is BCNF because multiple users can have the same username, so username depends on userid.
(Edited: 2021-03-17)
USER(USERID, USERNAME, EMAIL, PASSWORD) POST(POSTID, USERID, POST_TEXT, LIKES) USERID → USERNAME, EMAIL, PASSWORD POSTID → USERID, POST_TEXT, LIKES It is BCNF because multiple users can have the same username, so username depends on userid.

-- Mar 17 In-Class Exercise
USER(USERNAME, PASSWORD)
POST(USERNAME, DATE, POST_DATA, UPVOTES)
USERNAME → DATE, POST_DATA, UPVOTES, PASSWORD
BCNF compliant since USERNAME can fix USER and POST tables ?
(Edited: 2021-03-17)
USER(USERNAME, PASSWORD) POST(USERNAME, DATE, POST_DATA, UPVOTES) USERNAME → DATE, POST_DATA, UPVOTES, PASSWORD BCNF compliant since USERNAME can fix USER and POST tables ?

-- Mar 17 In-Class Exercise
 USERS(USERID, USERNAME, EMAIL, PASSWORD)
 POST(POSTID, USERID, USERNAME, CONTENT, POPULARITY)
 USERID → USERNAME, EMAIL, PASSWORD
 POSTID → USERID, USERNAME,CONTENT, POPULARITY
(Edited: 2021-03-17)
USERS(USERID, USERNAME, EMAIL, PASSWORD) POST(POSTID, USERID, USERNAME, CONTENT, POPULARITY) USERID → USERNAME, EMAIL, PASSWORD POSTID → USERID, USERNAME,CONTENT, POPULARITY

-- Mar 17 In-Class Exercise
Group: Sebrianne Ferguson, Rebecca Salas, Sean Chan
User table: (primary key = user_id) username, realname
Post table: (primary key = post_id, foreign key = User.user_id) post_content, post_time
Likes table: (primary key aggregate of foreign keys => User.user_id, Post.post_id)
 

--
To get the number of likes for the post: use SELECT COUNT(*) It is boyce cod normal
(Edited: 2021-03-17)
Group: Sebrianne Ferguson, Rebecca Salas, Sean Chan User table: (primary key = user_id) username, realname Post table: (primary key = post_id, foreign key = User.user_id) post_content, post_time Likes table: (primary key aggregate of foreign keys => User.user_id, Post.post_id) ------ To get the number of likes for the post: use SELECT COUNT(*) It is boyce cod normal

-- Mar 17 In-Class Exercise
user(username, password, post_id) post(username, post_id, likes, post_data) username -> password, post_id post_id -> username, likes, post_data
user(username, password, post_id) post(username, post_id, likes, post_data) username -> password, post_id post_id -> username, likes, post_data

-- Mar 17 In-Class Exercise
USER(EMAIL, UNAME, PWORD) User table- needs an email, a username, and a password
POST(PNUM, UNAME, LIKES) Post table- needs a post number, a username, and amount of likes PNUM->UNAME LIKES->PNUM
POP(UNAME, FOLLOWS) Popularity table- needs a username, and amount of follows FOLLOWS->UNAME
not BCNF- the PNUM can cause problems
(Edited: 2021-03-17)
USER(EMAIL, UNAME, PWORD) User table- needs an email, a username, and a password POST(PNUM, UNAME, LIKES) Post table- needs a post number, a username, and amount of likes PNUM->UNAME LIKES->PNUM POP(UNAME, FOLLOWS) Popularity table- needs a username, and amount of follows FOLLOWS->UNAME not BCNF- the PNUM can cause problems

-- Mar 17 In-Class Exercise
posts(post_id,title, description, popularity) likes(user_id, post_id) users(user_id, username, password, email) user_id -> username, password, email post_id -> title, description, popularity likes shows relationship between users and posts
(Edited: 2021-03-17)
<nowiki>posts(post_id,title, description, popularity) likes(user_id, post_id) users(user_id, username, password, email) user_id -> username, password, email post_id -> title, description, popularity likes shows relationship between users and posts</nowiki>

-- Mar 17 In-Class Exercise
Users(uid, username, password)
Posts(pid, uid, content, thumbsUp)
uid --> username, password
pid --> uid, content, thumbsUp
(Edited: 2021-03-17)
Users(uid, username, password) Posts(pid, uid, content, thumbsUp) uid --> username, password pid --> uid, content, thumbsUp

-- Mar 17 In-Class Exercise
USERS(USER_ID, USERNAME, PASSWORD, EMAIL)
POSTS(POST_ID, USER_ID, CONTENT, LIKES)
USER_ID --> USERNAME, PASSWORD, EMAIL
POST_ID --> USER_ID, CONTENT, LIKES
These tables are BCNF compliance because it avoids DB anomalies
(Edited: 2021-03-17)
USERS(USER_ID, USERNAME, PASSWORD, EMAIL) POSTS(POST_ID, USER_ID, CONTENT, LIKES) USER_ID --> USERNAME, PASSWORD, EMAIL POST_ID --> USER_ID, CONTENT, LIKES These tables are BCNF compliance because it avoids DB anomalies
[ Next ]
X