Question 1

Consider the following two tables, table X and table Y and answer the questions that follow:

Table X A B C 1 2 3 3 1 3 7 2 9

Table Y D E F 1 5 6 3 1 3 1 3 8

a. The result of the operation B Union All A. b. The result of the operation A Intersection B. c. The result of the operation A Union B. d. The result of the set difference operation A – B.

Question 2

Table 1: Baseball_member

STD_IDN Name Programme_Code Member_fees

001 Mary P01 $131

002 Jack P02 $350

003 Tom P03 $250

009 Donald P02 $120 Table 2: Dancing_member STD_IDN Name Programme_Code Member_fees

004 Kimmy P04 $350

002 Jack P02 $255

006 Mary P04 $387

009 Donald P02 $405

Table 3: Swimming_member

STD_IDN Name Programme_Code Member_fees

002 Jack P02 $177

007 Tim P03 $255

003 Tom P03 $347

If the relational operators (such as Intersect) are not available, that means you have to use SQL to implement it.

1. Find all Dancing members who take the Programme 'P04'. 2. Find all Dancing members' name. 3. Find all members in all Societies. 4. Find all members who join Baseball but not Dancing Society. 5. Find all members who join Baseball but not Dancing and not Swimming Society. 6. Find all members who join Dancing but not Baseball and not Swimming Society. 7. Find all members who join both Baseball and Dancing Society. 8. Find all members who join all societies, including Baseball, Swimming and Dancing. 9. Find out the students' ID, Name and Programme Name for each member in Baseball Society. 10. Find out the students' ID, Name, Programme Name and Course Name for each member in Baseball Society. 11. If I want to assign all courses to all Dancing members, how can I show this on screen? Question 3

Draw an E-R diagram for the case below. (Attributes of entities can be ignored)

J&J is a toyshop located in Central which is maintained by ten staff there.

Customers may come to the shop making enquiries about toys information.

There are mainly three types of toys, infant toys, TV games and educational toys.

Customers may order toys from the toyshop for a variety of toys. The toys in the J&J are supplied by a number of suppliers. After a Customer placing an order, he/she will receive an invoice with the toy(s).

 Customers can place as many orders as they wish.  Customers can make enquiries about toys sold in J&J.  Each order can contain any number of toys.  Each order results in one invoice.  A supplier may supply many different toys.  A single toy can be supplied by many suppliers. Question 4

(1) Find the dependecies of the Member_book table. (2) Try to normalize the table Member_book below into 3 NF tables.

Member_book

Member No Name City CallNo Title Book_ID DueDate 3 Avi PGH 301 DBS 84 10/12/99 5 Susan NYC 500 OS 50 11/12/99 2 Rajiv LONDON 20 AI 20 01/06/00 5 Susan NYC 400 PL 85 12/12/99 5 Susan NYC 301 DBS 86 02/29/00

Facts: (1) Each member has a name and member no. (2) Each member lives in one city. (3) Each book has a unique book ID. (4) Each book title has the same Call No.