Comp 305 midterm study guide

The primary databases for the exam problems will be the COMPANY and UNIVERSITY databases from E&N that we have used in the past.

The exam will be closed-note/closed-book, but I will give you a sheet of SQL examples, probably this. I'll also give you a diagram of the Company database, eg this.

Topics

Chapter 3:
Chapter 4:
Chapter 5: §5.1, §5.2
Chapter 6 on relational algebra will not be on the exam.

Chapter 7:

Chapter 8 on Extended ER diagrams will not be on the exam.

Chapter 9:
You will not have to know about string or date manipulation for the exam.

Indexes will not be on the exam.

Sample problems

Review the two SQL assignments; that material (except for the part on views) will be the most important part of the exam. Those assignments covered the material on their respective chapters, chapter 4 and chapter 5.

Chapter 7 (creating ER diagrams)
Chapter 9:

Additional exercises

Solutions are here.

In the SQL demo examples below,

1. Describe in English what is being asked for in demo example 8.

2. Give an alternative solution for example 8 that does not involve an inner query.

3. In English, who is getting the raise in example 5? Is this fair?

4. Write query 7a using an inner query instead of a join.

5. Write insert statements so the following query returns (2, 30000, 40000):

select count(*), avg(e.salary), max(e.salary) from employee2 e
where e.dno = 5;

6. Write a query to print the number of employees, average salary and max salary for all departments with an average salary >= 30000. Also include the department number.