Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

create table likePost uaerID char (10) poat ID char (50) dateLiked date primary

ID: 3822376 • Letter: C

Question



create table likePost uaerID char (10) poat ID char (50) dateLiked date primary key (userID Post ID, dateLiked) foreign key (userID) referenc userProfile (id), es foreign key (poatID) references post(post ID) Please write the following queries in SQL: 1. Find users' full names who participate in an activity topic cuss400 Eram 2 held ou April 20, 2017 in New York City (5 points) 2. Find full names of users who have commitment to participate in activities that are located at different locations on the same date. (7 points)

Explanation / Answer

Ans 6

If some drop staement are executed to drop all primary and forign keys in the database then these below
things happen:
1 It actually destroy all the primary key constraint
2 It also destroy the corresponding referential constraint related to this primary key from all table
3. It deletes all references from system catlog to the primary key constraint

As we know it makes changes to system catalog so whenever we fired the queries which retrive the data from
two or more table based on relationship it will not give exact solution or output what we want.If we retrive the data from tables without join we can use cross join but it will give us every possible combination from each table.So we did'nt get exact data what we want.

Ans 8

for this we have to use relationshio between three as given

select a.actID,p.postID,a.topic from activity a join userProfile u on a.hostUser=u.id join post p on p.userID=u.id;