Skip to content Skip to navigation

Connexions

You are here: Home » Content » Exercise 3: Relational Calculus and QBE

Navigation

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? tag icon

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

This content is ...

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.
 

Exercise 3: Relational Calculus and QBE

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

Exercise 1

Consider the following database schema

Student (StudentId, FullName, BDate, Address)

Course (Code, Name, Lecturer)

Enrol(StudentId, Code, Grade)

Specify the following queries in domain and tuple relational calculus

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

Exercise 2

Consider the COMPANY database schema (Based on exercise 6.16 – Textbook)

EMPLOYEE (SSN, Name, Bdate, Address, Salary, DeptId)

DEPARTMENT(DeptId, Dname, Office, Mng-SSN)

PROJECT(Code, Name, Budget, DeptId)

JOIN(ESSN, PCode, StartDate)

EMP-DEPENDENT(ESSN, Dependent-Name, Bdate, Relationship)

Specify the following queries in domain and tuple relational calculus

  1. Retrieve the names of all employees in department 5 who work on ProductX project
  2. List the names of all employees who work on every project of department number 5
  3. Retrieve the name of all department managers who have no dependents
  4. Retrive the name of all employees who works in the same department as John Smith
  5. List the name of all employees who work in department managed by Sara Miller

Exercise 3

Specify queries of Exercise 2 in QBE

Exercise 4

Consider the COMPANY database, specify the following queries in QBE

  • For each project, list the project name and number of employees work on that project
  • Which employees works on three or more project
  • Find the average budget of all projects of department Research
  • How may projects are belongs to each department, list the department name and the number of projects of each department. Order the list by number of projects.
  • Department number 5 has new manager – Raymon Wong
  • Add new dependent record for employee Raymon Wong. He has a newborn son named Sean Wong
  • All employees who work in project number 5 now also join in project number 4

Content actions

Download module as:

PDF | EPUB (?)

What is an EPUB file?

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

Downloading to a reading device

For detailed instructions on how to download this content's EPUB to your specific device, click the "(?)" link.

| More downloads ...

Add module to:

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? tag icon

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