Database assignment

profileaboodi777
relational_algebra_calculus_.docx

RELATIONAL WORK SITUATION—INDIVIDUAL ASSIGNMENT

Assume there are six actors, named Moe, Larry, Curly, Joe, CurlyJoe, and Shemp.

There were many episodes. Episode titles are not important, and can be made up.

This is slapstick. There are many gags. Gags are done by one actor to another in an episode.

Attributes of Episode are Eid, title.

Attributes of Actor are Aid, sName.

Attributes of Star are Aid,Eid.

(Assume every episode has 3 stars if needed.)

Attributes of Gag are gType, dBy, dTo, Eid.

(dBy is actor ID who did the gag, dTo is actor ID who had the gag done to him, Eid is episode.)

Attributes of GagName are gType and gName.

Sample gags(gName) include :

GetOutOfHere; NyukNyukNyuk; HeadBonk; Slowly I turn

Consider the following desired queries:

List all episodes where someone other than Curly does ‘NyukNyukNyuk’. (NNN).

List all episodes in which a star has a gag done to him, which he then does to another star.

List stars that appear in every episode.

List stars that never do HeadBonk (HB).

List episodes where someone does ‘NyukNyukNyuk’ (NNN) to Curly.

List episodes where both other stars do the same gag to Moe.

RELATIONAL ALGEBRA

Pick TWO of the relational algebra queries produced by your group,

that were NOT also done for Relational Calculus.

Convert the relational algebra to relational calculus.

Give how ONE of them would be done in SQL.

Hand in the final written relational calculus and SQL queries.

RELATIONAL CALCULUS

Pick TWO of the relational calculus queries produced by your group,

that were NOT also done for Relational Algebra.

Convert the relational calculus to relational algebra.

Give how ONE of them would be done in SQL.

Hand in the final written relational algebra and SQL queries.