0% found this document useful (1 vote)
48 views

Query Languages Tutorial One

This document provides exercises to evaluate relational algebra operations on tables A, B, and C. Exercise 1 has students perform operations like union, difference, and intersection on tables A and B and list the resulting tables. Exercise 2 asks students to determine the number of tuples and attributes that would result from a product of tables A and C. Exercise 3 shows tables for movies, actors, producers, and productions and asks students to identify which relational algebra operations were used to obtain the results in parts a through f based on the input and output relations.

Uploaded by

Ashim Mahat
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
48 views

Query Languages Tutorial One

This document provides exercises to evaluate relational algebra operations on tables A, B, and C. Exercise 1 has students perform operations like union, difference, and intersection on tables A and B and list the resulting tables. Exercise 2 asks students to determine the number of tuples and attributes that would result from a product of tables A and C. Exercise 3 shows tables for movies, actors, producers, and productions and asks students to identify which relational algebra operations were used to obtain the results in parts a through f based on the input and output relations.

Uploaded by

Ashim Mahat
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

CET341 – Advanced Databases

Tutorial Session 4
EXERCISE 11

Using the following tables, evaluate the relational algebra operations listed
below, i.e. show the resulting tables for each operation

TABLE A TABLE B
Order Company City Order Company City
Number Number
A1002 Rentokil London E0102 Halifax plc Halifax
A3333 Eurotunnel Paris D2489 Hanson London
B0987 Kwikfit Glasgow B0987 Kwikfit Glasgow
C7521 BT Edinburgh
E0102 Halifax plc Halifax

(a) A UNION B
(b) A - B
(c) B – A
(d) A INTERSECT B
(e) (A UNION B) [city]
(f) A[city] UNION B[city]
(g) A[company,city] DIFFERENCE B[city]

EXERCISE 2

Using Table A from exercise 1 above, and the following Table C, answer the
following two questions:

TABLE C
Supplier Supplier Name
Number
S900 Ricoh
S804 HP
S805 Canon

(a) How many tuples would be produced by performing A PRODUCT C?


(b) How many attributes would there be in the result of A PRODUCT C?

Exercise 3 is on the following page.

1
Exercise 1 can be found in Ritchie C, Relational Database Principles, Continuum, 1998, p39
EXERCISE 3
Use the following tables for this exercise:

Movie Actor Producer


Title Year Name Name
Shrek 2000 Mike Myers Mike Myers
Austin Powers 1997 Liz Hurley Jeffery Katzenberg
Eddie Murphy

ProducedBy Stars
Title Name Title Name
Shrek Jeffery Katzenberg Shrek Mike Myers
Austin Powers Mike Myers Austin Powers Mike Myers
Shrek Eddie Murphy
Austin Powers Liz Hurley

Examine the following result tables and state, for each of (a) to (f), which
relational algebra operation has been performed, and which relation(s) are
involved:

(a) (e)
Name Title Year Name
Mike Myers Shrek 2000 Mike Myers
Liz Hurley
Eddie Murphy Shrek 2000 Jeffery
Jeffery Katzenberg Katzenberg
Austin 1997 Mike Myers
Powers
(b) Austin 1997 Jeffery
Name Powers Katzenberg
Liz Hurley
Eddie Murphy
(f)
Title Year Name
(c) Shrek 2000 Mike Myers
Name
Mike Myers Shrek 2000 Eddie
Murphy
Austin 1997 Mike Myers
(d) Powers
Title Name Austin 1997 Liz Hurley
Shrek Mike Myers Powers
Shrek Eddie Murphy

You might also like