Database concepts

Assessment

Assignment One

For this assignment you will create a library database and write some queries for it. The library database will also form the basis of your third assignment.

This assignment has two parts

Part A: Build the database

Individually:

  1. Create the tables: Using the CREATE command in SQL, create the four tables in your Oracle account. Assign appropriate datatypes, sizes and whether NULL values are allowed.
    You can use the DESCRIBE command to check that you have created each of the tables correctly.
  2. Populate the tables: Download the Library file. This file contains sample data for each table in text files. Also there is a .ctl control file for each table. Use SQL*Loader to populate the tables with data.
  3. Add a record: Create yourself as a borrower and take a book out on loan from the Casuarina branch.

Hand ins
There are no hand ins for this part of the assignment as it will be marked in class. You need to show your working database to either Bob or Jodi.

Part B: Write the queries

In pairs:

  1. Create four questions and the SQL statements that answer them. Your queries should exhibit some interesting feature of SQL such as queries over more than one relation, grouping or aggregation for example. When marking your queries we will be looking for different sorts of queries.

    You should run your queries on the database to make sure they work as you will be swapping your queries in class with another group.

Hand ins:
Post your questions on Learnline.
Email your SQL statements that answer your queries to hit234@cdu.edu.au.

Library Database

The following is a schema for a library system. A borrower can take a book out on loan from a library branch.

Schema

Note that there are four tables and are described as:

BORROWER

BOOK

LOAN

BRANCH