0% found this document useful (0 votes)
16 views5 pages

Exercises

This document provides an introduction to databases, explaining their purpose and common uses. It outlines methods for creating, opening, renaming, and deleting database files in Microsoft Access 2007, along with exercises to create and query various relational database schemas. The document also includes detailed instructions for managing data within these schemas.

Uploaded by

dagmawitlegesse6
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views5 pages

Exercises

This document provides an introduction to databases, explaining their purpose and common uses. It outlines methods for creating, opening, renaming, and deleting database files in Microsoft Access 2007, along with exercises to create and query various relational database schemas. The document also includes detailed instructions for managing data within these schemas.

Uploaded by

dagmawitlegesse6
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Introduction to database

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:

- Member accounts in websites

- Credit card information in an ATM machine

- Documents that can be searched in your computer.

- Book information in a library system

II. How to Create Database file

We have three ways to create a database file. However, in this tutorial, we select two ways to
introduce you. The two ways are:

- How to create a database file via Blank Database Wizard

- And how to create a database file via Local Template Database File

II.1. How to Create a database file via Blank Database Wizard

To create a database file, you have to do the following:

- 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

IV. How to Open Existing Database File

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.

V. How to Rename Database File

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.

VI. How to Delete Database File

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. Get full details of all the projects in London.


b. Get supplier no. for suppliers who supply project J1.
c. Get supplier details for suppliers who supply part P2.
d. Get supplier names for suppliers who do not supply part P2.
e. For each shipment get full shipment details, including total shipment weight.
f. Get all shipments where the quantity is in the range 300 to 750 inclusive.
g. Get all distinct part-color combinations.
h. Get supplier no. for suppliers in Paris with status > 20.
i. Get part nos. for parts that either weigh more than 16 pounds or are supplied by
supplier S2, or both.
j. Get part cities that store more than five red parts.

2.Create Purchase order relational database schema, as follows:

PURCHASE ORDER RELATIONAL DATABASE SCHEMA

RELATION NAME ATTRIBUTES


VENDOR Vendorno, vname, street, city, region, zip, contact
PRICEINFO Partno, vendorno, catno, price
POHEADER Orderno, orddate, vendorno, invoiceno, status
PODETAIL Orderno, partno, _qty, unit-pr
PART Partno, description
POHISTORY Orderno, orddate, vendorno, invoiceno, pototal
The underlined fields are the primary key. Fill data into the table and perform the
following Queries:

a. Display all the rows in the part table, sorted by description.


b. Display the part description for the part number 4.
c. Select all columns of the PODETAIL table which a quantity greater than 500.
d. Display all part numbers, descriptions, prices, catalogue numbers and vendor
numbers and names.
e. How many vendors are located in the city of NewYork?
f. Find the unit price and quantity information for order number 1101.
g. Which parts are priced at the lowest price?

3.Create the following tables:


RELATION ATTRIBUTES
NAME
BOOKS Book_id, Book_name, Author_name, Publishers, Price, Type,
Quantity
ISSUED Book_id, qty_issued
The underlined fields are the primary key. Fill data into the table and 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.

4.Create Library Management relational database schema, as follows:

LIBRARY MANAGEMENT RELATIONAL DATABASE SCHEMA

RELATION NAME ATTRIBUTES


BOOK Book_id, title, pub_id
BOOK_AUTHORS Book_id, author_name
BOOK_COPIES Book_id, branch_id, noof_copies
BOOK_LOANS Book_id, branch_id, card_no, dateout, duedate
LIBRARY_BRANCH Branch_id, branch_name, address
BORROWER Card_no, name, address, phone
PUBLISHER Pub_id, Pub_name, address, phone_no

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.

You might also like