Technical DBA Interview Questions

Suppose you have a database with two tables, employee and department (see below for exact schema). Write a SQL statement to answer the following questions:

  1. Show a list of all employees that includes both the employee name and the department name.
  2. Show a list of departments and include the number of employees in each department.
  3. Show a list of all departments with no employees.
  4. Show a list of departments with more than 2 employees
  5. Show a list of departments that includes average and maximum salary in that department. Sort the list by the average salary.
Employee Table
---------------------
id
first_name
last_name
salary
department

Department Table
-----------------------
id
name

Describe a schema (or classes) to power an online restaurant reservation system. Describe the tables and the relationships beween the tables.

This system should allow a user to reserve a table at a restaurant for a certain time period and a certain party size.

It should allow the restauranteur to configure the system to describe their restaurant and manage reservations.

Think http://opentable.com