Exercises
Exercises
I. What is Database?
Database is a warehouse or house for storing, processing, and securing the data. The examples
below show the uses of databases that you commonly encounter:
We have three ways to create a database file. However, in this tutorial, we select two ways to
introduce you. The two ways are:
- And how to create a database file via Local Template Database File
- Click Start--> All Programs--> Microsoft Office--> Microsoft Office--> Microsoft Office
Access 2007--> Office Button--> New
-->Or you can click New Blank Database
File Name: Enter a database’s name.
Folder Open Icon: Brow for a location to put your database.
Create Button: Create a new database.
- Write database name in the file name box
- Click Folder Open
- Click Create button
II.2. How to Create a database file via Local Template Database Wizard
To create a local template database file, you have to do the similar way as shown
above:
--> Start-> Program--> Microsoft Office--> Microsoft Office Access 2007
Local Templates--> select any local database templates which you like
III. How to Exit from Microsoft Access 2007
To exit from Microsoft Access 2007, you have to do the following:
- Click Button Office
-Click Exit Access or Click Close Button or Press Alt+F4
If you want to open existing database file--Microsoft Access file which you created
before, you have to follow the step below:
--> Open Ms.Access 2007--> Click Button Office--> Click Open as figure below:
After you click Open, Open File Dialog will load; then you can select any database
file that you want to open; next click Open Button.
You can rename any database file you named it before by practicing as the
following:
- Find the location of database file stored
- Right-click database file you want to rename
- Click Rename
- Write new name for database file and make sure database file extension (accdb)
unchanged
- Press Enter Key.
You sometimes want to remove database file that you created because you do not
need to use it any more or because this file is useless. You can delete it by
following the steps below:
- Close database file you would like to delete
- Find location of database file located in hard drive or other storage devices
- Right-click database file
- Click delete or Select database file
- Press Delete Key
Exercises
1 Create Suppliers and Parts relational database schema as follows:
RELATION NAME ATTRIBUTES
SUPPLIER SNo, Sname, Status, City
PARTS PNo, Pname, Color, Weight, city
PROJECT Jno, Jname, City
SHIPMENT Sno, Pno, Jno, Quantity
The underlined fields are the primary key. Fill in the appropriate data in the tables.
Perform the following queries:-
a. Display book name, author name and price of books of Pearson publishers.
b. Display book name, author name and price of books that have been issued.
c. Give the output of the following queries
a. SELECT COUNT(DISTINCT Publishers) FROM Books;
b. SELECT COUNT(*) from Books;
c. SELECT SUM(Price) FROM Books WHERE Quantity > 5.
The underlined fields are the primary key. Fill data into the table and perform the
following Queries:
a. Retrieve the names of all borrowers who do not have any books checked out.
b. For each library branch, retrieve the branch name and the total number of books
loaned out from that branch.
c. Retrieve the names, addresses, and number of books checked out for all borrowers
who have more than five books checked out.