Exercise

6.1. Consider a university database, it has two relations:

  • department(dept_name, building, budget)
  • instructor(ID, name, dept_name, salary)

Please write SQL statements to create the two relations.


6.2. Dump some data into university database using INSERT INTO statements.


6.3. Find those departments where the average salary of the instructors is more than 100000.


6.4. Find those departments whose building name includes the substring TongBo.


6.5. Find the names of instructors with salary amounts between 90000 and 100000.


6.6. Please add update and delete statements for Main.java in ch6/jdbc.


6.7. Please refactor ch6/datasource and let it follow MVC design.


6.8. Re-implement the book-selling website using a database.