Você está na página 1de 2

College of Computing Education

3rd Floor, DPT Building


Matina Campus, Davao City
Telefax: (082)
Phone No.: (082)300-5456/305-0647 Local 116

Laboratory Activity: Advanced Structured Query Language


Objectives
1. To identify the relational operators
2. To illustrate the advanced SQL operators
Materials
 Pencil/Pen

Procedure

Table Joins, a mustExercises


Advanced SQL 5
Procedure
1. Create the following entity shown below and encode also the tuples using the MySQL IDE.
2. Assigned also an appropriate data type for each attribute of the entity. By using the MySQL query
analyzer, create a code to display the following output based on the following relational table:
tbl_Household
hhNo headNo spouseNo employmentNo year
1 2 1 1 2008
2 1 2 2008
3 3 2 2 2008
4 2 1 1 2009
5 1 3 2 2009
6 3 2 2 2009
Note: headNo is a foreign key references tbl_Heads(headNo)
spouseNo is a foreign key references tbl_Spouse(spouseNo)
employmentNo is a foreign key refences tbl_Employment(employmentNo)
tbl_Heads
headNo headName genderNo
1 Timillar, Aaron 1
2 Mondero, Noel 1
3 Acuna, Riza 2
Note: genderNo is a foreign key references tbl_Gender(genderNo)

tbl_Spouse
spouseNo spouseName genderNo
1 Bual, Millan 2
2 Amolato, Ryan 1
3 De Guzman, Roderica 2
Note: genderNo is a foreign key references tbl_Gender(genderNo)

tbl_Employment
employmentNo employmentDesc
1 Employed
2 Self Employed
3 Unemployed

tbl_Gender
genderNo genderDesc
1 Male
2 Female

Output A:
IT225/L Page 1
College of Computing Education
3rd Floor, DPT Building
Matina Campus, Davao City
Telefax: (082)
Phone No.: (082)300-5456/305-0647 Local 116

No Heads Spouse Employment Year


1 2 1 1 2008
2 1 2 2008
3 3 2 2 2008

Output B:
No Heads Spouse
1 Mondero, Noel Bual, Millan
2 Timillar, Aaron
3 Acuna, Riza Amolato, Ryan

Output C:
No Heads Gender
1 Mondero, Noel Male
2 Timillar, Aaron Male
3 Acuna, Riza Female

IT225/L Page 2

Você também pode gostar