# Connexions

You are here: Home » Content » Homework 1

### Lenses

What is a lens?

#### Definition of a lens

##### Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

##### What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

##### Who can create a lens?

Any individual member, a community, or a respected organization.

##### What are tags?

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

#### Affiliated with (What does "Affiliated with" mean?)

This content is either by members of the organizations listed or about topics related to the organizations listed. Click each link to see a list of all content affiliated with the organization.
• VOCW

This module is included inLens: Vietnam OpenCourseWare's Lens
By: Vietnam OpenCourseWare

Click the "VOCW" link to see all content affiliated with them.

### Recently Viewed

This feature requires Javascript to be enabled.

# Homework 1

Module by: Nguyen Kim Anh. E-mail the author

## Relational Algebra

Due date: 5pm – Friday of week 5.

Late submission is not acceptable

### Question 1

Consider the relations

Show the results of the following expressions.

1. ΠEG(σA=a2A=a3(st))ΠEG(σA=a2A=a3(st)) size 12{Π rSub { size 8{ ital "EG"} } $$σ rSub { size 8{A=a2 or A=a3} } \( s*t$$ \) } {}

2. ΠAD(t)÷ΠA(r)ΠAD(t)÷ΠA(r) size 12{Π rSub { size 8{ ital "AD"} } $$t$$  div Π rSub { size 8{A} } $$r$$ } {}

3. ΠAD(r×s)AD(t)ΠAD(r×s)AD(t) size 12{Π rSub { size 8{ ital "AD"} } $$r times s$$ \Π rSub { size 8{ ital "AD"} } $$t$$ } {}

### Question 2

Consider two relations R1 and R2, where R1 contains N1 tuples and R2 contains N2 tuples, and N1 > N2 > 0. Give the minimum and maximum possible sizes (in tuples) for the result relation produced by each of the following relational algebra expressions. In each case state any assumptions about the schemas of R1 and R2 that are needed to make the expression meaningful.

1. R1R2R1R2 size 12{R1 union R2} {}

2. R1R2R1R2 size 12{R1 intersection R2} {}

3. R1}R1} size 12{R1\R2} {}

4. R1×R2R1×R2 size 12{R1 times R2} {}

5. σa=5(R1)σa=5(R1) size 12{σ rSub { size 8{a=5} } $$R1$$ } {}

6. πa(R1)πa(R1) size 12{π rSub { size 8{a} } $$R1$$ } {}

7. R1÷R2R1÷R2 size 12{R1 div R2} {}

### Question 3

Consider the following database schema

Course (Code, Name, Lecturer)

Specify the following queries in relational algebra

• List the name of all courses
• List the StudentId, FullName of students who lives in Hanoi
• List the StudentId of students who enrol in course ‘COMP-1101’ but not in course ‘COMP-1102’
• List the name of students who enrol in both course ‘COMP-1101’ and course ‘COMP-1102’
• List the name, lecturer of all course in which student ‘John Smith’ has enroled
• List the name of student who enrol in at least one course teach by Professor Le Quan
• List the name, address of all student who enrol in every course teach by Professor Le Quan
• List the name of the course which has no student enrolled in

## Content actions

PDF | EPUB (?)

### What is an EPUB file?

EPUB is an electronic book format that can be read on a variety of mobile devices.

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

#### Definition of a lens

##### Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

##### What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

##### Who can create a lens?

Any individual member, a community, or a respected organization.

##### What are tags?

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks