Sei sulla pagina 1di 22

Practical Reader Edb1

(v 3.5)
Week schedule:
Week Action Deliverables Completed?
1 Install MS-Access (English version)
Read and do all the exercises of the Database with filled tables Student,
‘Getting started with Ms-Access’-
Class and Grade with relations.
reader review Question A1, page 39.
QBE-QueryA01
A: QBEQueryA02
B: Student Data Input Form
C: Class Data Input Form
D: Class Form
E: Student Data Report
F: Optional: Class Grade Report
2 SQL Queries on the Wedgewood Queries A, B, C, D, E, F
Pacific Corporation (WPC) database
3 SQL Queries on the Wedgewood Queries G, H, I, J, K
Pacific Corporation (WPC) database

Study bike Shop ‘de Vries’ First draft normalizing


4 SQL Queries on the Cape Codd Queries L, M, N, O, P, Q, R, S
database

Study bike Shop ‘de Vries’ Second draft normalizing


5 SQL Queries on the Wedgewood Queries T, U, V, W, X
Pacific Corporation (WPC) database
Normalizing steps till 3NF
Normalization exercise ‘Bike shop Normalized strip diagram
de Vries’ (see Appendix A)
6 SQL Queries on the Wedgewood Queries Y, Z, AA, BB, CC, DD
Pacific Corporation (WPC) database

Show your work (deliverables) to your teacher each week in practical class.
Week 1
Objectives
Is this week’s lesson you’ll install MS-Access and get some basic knowledge using it. You learn how to
create a new database, create tables and fill them with data and how to make simple forms and
reports.

Resources
 MS-Access 2010, 2013 or 2016. (Free download at DreamSpark/MSDN-AA!)
 Reader: Getting started with MS-Access. Available on SharePoint.
 Textbook: Database Processing by Kroenke and Auer (12th or 13th edition)

Assignments & Deliverables


A. Install MS-Access (English version)
B. Read and do all the exercises of the ‘Getting started with Ms-Access’- reader review Question
A1, page 39.
Week 2
Objectives
Creating SQL queries on an existing Microsoft Access database

Resources
 MS-Access 2013 or 2016. (Free download at MSDN-AA!)
 Wedgewood Pacific Corporation database: WPC.accdb
 Textbook: Database Processing by Kroenke and Auer (12th or 13th edition)

Assignments & Deliverables


For this set of assignments, we will use a Microsoft Access database for the Wedgewood Pacific
Corporation (WPC). Founded in 1957 in Seattle, Washington, WPC has grown into an internationally
recognized organization. The company is located in two buildings. One building houses the
Administration, Accounting, Finance, and Human Resources departments, and the second houses the
Production, Marketing, and Information Systems departments. The company database contains data
about company employees, departments and company projects.

The Wedgewood Pacific Corporation database is available on sharepoint (WPC.accdb) and contains
the following four tables

DEPARTMENT (DepartmentName, BudgetCode, OfficeNumber, Phone)


EMPLOYEE (EmployeeNumber, FirstName, LastName, Department, Phone, Email)
PROJECT (ProjectID, Name, Department, MaxHours, StartDate, EndDate)
ASSIGNMENT (ProjectID, EmployeeNumber, HoursWorked)

The figure below shows the relationships in the database


Using Access SQL, create and run queries to answer the following questions. Save each query using
the query name format SQL-Query-#, where the # sign is replaced by the letter designator of
the question. For example, the first query will be saved as SQL-Query-A. Write SQL queries to
produce the following results:

A. What projects are in the PROJECT table? Show all information for each project.

B. What are the ProjectID, Name, StartDate, and EndDate values of projects in the PROJECT table?

C. What projects in the PROJECT table started before August 1, 2008? Show all the information for
each project.

D. What projects in the PROJECT table have not been completed? Show all the information for each
project
E. Which projects contain the word ‘Q3’ in the project name and have been started in august 2008?
Show the project ID, project Name and Start Date.

F. Make a list of all different first names of employees. Order them alphabetically from Z to A.
Week 3
In addition to the SQL exercises below, week 3, 4 and 5 also contain a normalizing exercise.
This exercise is described after the last SQL exercises of week 6!

G. Which employees work for the Administration, Accounting, Production and Legal departments?
Show the employee number, first name, last name and department name. Order the results in
alphabetical order of the department name and then in alphabetical order of the employee’s last
name

H. How many projects are being run by the marketing department? Be sure to assign an appropriate
column name to the computed results.

I. What is the total MaxHours of projects being run by the marketing department? Be sure to assign
an appropriate column name to the computed results
J. What is the average MaxHours of projects being run by the marketing department? Be sure to
assign an appropriate column name to the computed results.

K. How many projects are being run by each department? Be sure to display each DepartmentName
and to assign an appropriate column name to the computed results.
Week 4
In addition to the SQL exercises below, week 3, 4 and 5 also contain a normalizing exercise.
This exercise is described after the last SQL exercises of week 6!

L. What is the total price per order (use ORDER_ITEM)?

M. What is the total price per order, for orders that have total quantity of items more than 2?

N. What is the total price per order, for orders with more than 2 different items?

O. What is the average item price per order?

P. For which SKU’s the average QuantityOnHand is greater than the highest QuantityOnOrder for
any Warehouse?
Q. For which Warehouses the total QuantityOnHand is greater than the total QuantityOnOrder?

R. For which Warehouses the total QuantityOnHand for Tents is greater than half the total
QuantityOnOrder?

S. Give the total quantity of all sku items in all the warehouses. Name the columns as sku,
sku_description and QOH?
Week 5
In addition to the SQL exercises below, week 3, 4 and 5 also contain a normalizing exercise.
This exercise is described after the last SQL exercises of week 6!

T. Which employees have been assigned to at least 2 projects and have worked at least 20 hours on
each of these projects? List the employee number and the number of projects for which the
employee worked at least 20 hours.

U. Which projects are run by a department which uses the budgetcode 'BC-700-10'. Use a subquery.

V. Which projects are run by a department with phone number 088-850 8500. Use a subquery.

W. What is the minimum and the maximum amount of hours worked by an employee, for each
project? List the projectID, the minimum amount of hours worked and the maximum amount of
hours worked.
X. Which employees are working for office number BLDG01-300? List the employee number, first
name and last name. Use a sub-query to solve this exercise
Week 6
Y. Who are the employees assigned to each project? Show ProjectID, Employee-Number, LastName,
FirstName, and Phone.

Z. Who are the employees assigned to each project? Show the ProjectID, Name, and Department.
Show EmployeeNumber, LastName, FirstName, and Phone.
AA. Who are the employees assigned to each project? Show ProjectID, Name, Department, and
Department Phone. Show EmployeeNumber, LastName, FirstName, and Employee Phone. Sort by
ProjectID in ascending order.

BB. Who are the employees assigned to projects run by the marketing department? Show ProjectID,
Name, Departmentname (of the employee), and Department Phone. Show EmployeeNumber,
LastName, FirstName, and Employee Phone. Sort by ProjectID in ascending order.

CC. Which employees have been assigned to a project? Show the employee number, first name and
last name. Make 2 different queries to solve this problem!
DD. List the employees that have worked in total more than 100 hours for marketing projects. List the
employee number, last name, first name and the total amount of hours worked for marketing
projects
Week 3, 4 and 5– Normalizing exercise
Objectives
Practise normalization.

Resources
 This practical reader
 Presentation and the reader about normalizing
 Textbook: Database Processing by Kroenke and Auer (11th or 12th edition)

Assignments & Deliverables


Read the case description of the normalization exercise ‘Bikeshop de Vries’ in appendix A.

a) Give the result of the normalization process till the 3rd NF, write down at least the steps
0th, 1st and 3rd NF.
b) Show the result in a strip diagram. Don’t forget to name the strips and to point out the
primary keys, foreign keys and relationships.
Remarks
1) Make use of the ‘criteria’ in the bottom pane.
2) The picture 1-x refer to the pictures in the textbook. The pictures are available on sharepoint.
3) Queries must be made according to the method explained in the chapter: ‘Processing SQL
statements in MS-ACCESS’ on page 72/73 and further. QBE is NOT allowed!
Appendix A: Normalization exercise
‘Bike shop De Vries’
Bike shop De Vries
De Vries is a bike shop located in Eindhoven which sells and repairs all types of bikes.

When a customer wants a bike to be repaired the mechanic fills in a repair sheet. Examples of this
sheet can be found below. The mechanic writes down the customer’s data and agrees upon a date
on which the mechanic expects the repair to be finished.

After fixing the bike, the mechanic fills in the repair sheet. He fills in the parts used as well as the
operations done while repairing this bike. For each of these activities (identified by a code) the
duration (in minutes) is written down. Besides the activity code, a description of the activity is
written down on the sheet.

At the end of the day the mechanic fills in the sheet with the operations done so far. Notice that it is
possible that an activity which lasts more than one day is registered on the sheet.

All prices and (sub)totals are without 21% VAT. On the final invoice this VAT has to be included.

Assumptions:
1. Wages are € 1, - per minute (without VAT), independent of the activity done. This may be
implemented as a constant value.
2. Serial numbers of the bikes are unique.
3. The repair sheet serves both as a registration sheet as an invoice.
De Vries bikes
Sheet number 1 Name mechanic Arie
Planned completion date 06-mar-2013

Customer Bike
Number P-1256 Bike make Giant
Name Zandstra Type Cabriolet
Address Dorpstraat 25 Frame nr 64777858
Postcode 5538 XT
City Aalst

Parts
Article code Description Amount Unit price Subtotal
CA-2881 Crank axle 1 63,50 63,50
PD-2332 Pedal 2 5,95 11,90
RF-3324 Reflector 4 2,50 10,00

Total Parts 85,40

Wages
Date Code Description Elapsed time Price
5-3-2013 ASSY Parts assembly 30 30,00
5-3-2013 SERV Servicing 45 45,00
6-3-2013 SERV Servicing 25 25,00

Total Wages 100,00

V.A.T.(21 %) 38,93

Total repair price 224,33


De Vries bikes
Sheet number 2 Name mechanic Fred
Planned completion date 22-May-2013

Customer Bike
Number P-2358 Bike make Gazelle
Name van Vliet Type Sportivimo
Address Floralaan 332 Frame nr 25252411
Postcode 5631 BT
City Eindhoven

Parts
Article code Description Amount Unit price Subtotal
CA-2881 Crank axle 1 63,50 63,50
PD-2332 Pedal 2 5,95 11,90
RF-3324 Reflector 4 2,50 10,00
DH-0010 Derailleur 10 speed handles 1 26,50 26,50
DR-0010 Derailleur 10 speed 1 85,00 85,00

Total Parts 196,90

Wages
Date Code Description Elapsed time Price
21-5-2013 ASSY Parts assembly 65 65,00
21-5-2013 SERV Servicing 45 45,00
22-5-2013 ASSY Parts assembly 25 25,00
22-5-2013 SERV Servicing 25 25,00
22-5-2013 BAL Balancing frame 35 35,00

Total Wages 195,00

V.A.T. (21 %) 82,30

Total repair price 474,20


De Vries bikes
Sheet number 3 Name mechanic Fred
Planned completion date 15-jan-2013

Customer Bike
Number P-2356 Bike make Union
Name van Dam Type Speed unlimited
Address Schenkstraat 55 Frame nr 66888811
Postcode 5830 GT
City Veldhoven

Parts
Article code Description Amount Unit price Subtotal
HB-0112 Triathlon handlebars 1 63,50 63,50
BH-2332 Brake handles 2 11,00 22,00
HB-1222 Tape Handlebars 1 0,95 0,95
TI-0028 Tire 28 “ 2 35,00 70,00
TU-0028 Tube 28 “ 2 15,00 30,00
SL-1221 Bicycle sadle leather 12 cm springs 1 147,00 147,00

Total Parts 333,45

Wages
Date Code Description Elapsed time Price
15-1-2013 ASSY Parts assembly 120 120,00
15-1-2013 SERV Servicing 25 25,00
15-1-2013 TIRE Repair / change of tires 25 25,00

Total Wages 170,00

V.A.T. (21 %) 105,72

Total repair price 609,17


Errata
Page A-27: The NOTE at item 7 should read: “In Student, StudentNumber is the primary key, and in
GRADE, StudentNumber is the foreign key.”

Page A-31: The last word at item 11. must be “CLASS” instead of “CUSTOMER”.

Potrebbero piacerti anche