0% found this document useful (0 votes)
23 views37 pages

Pass Databases by Kenyana Dude

Access exam module

Uploaded by

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

Pass Databases by Kenyana Dude

Access exam module

Uploaded by

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

DATABASE QUESTION TUTORIAL ONE

Qn: Using any database management system of your choice, create a database and save it as KASALE LIMITED.

Employee Id. First name Last name Date of Birth Residence


MGM/001 Davis Lutakome 15-11-1980 Mawoito
MGM/002 Peterson Waiswa 16-02-1978 Kakira
MGM/003 Henry Kasujja 14-09-1979 Kakira
MGM/004 Johnson Ludhuba 21-03-1984 Mawoito
MGM/005 Godfreys Kodheyo 0-12-1980 Wairaka
MGM/006 Humprey Makoma 21-08-1974 Musiima
MGM/007 Dicson Kitakufe 19-10-1986 Kakira
MGM/008 Derek Nhala 10-01-1981 Mawoito

Instructions:
Create a table and save it as EMPLOYEE_TAB and enter the data in the table above.

Note: the more important things to take into consideration include the following:
1. How to create a database.
2. How to create a table in the database.
3. How to create/add the fields in the table.
4. A look through the choice of appropriate datatype for each field.
5. Entering the records into the table.

Prepared by Wejuli Moses and Compiled by Engr. Mulimbi Bricious 1


QUESTION TWO: FIELD FORMATS
Qn: Using any database management system of your choice, create a database and save it as KASALE LIMITED.

Employee Id. First name Last name Date of Birth Residence


MGM/001 Davis Lutakome 15-11-1980 Mawoito
MGM/002 Peterson Waiswa 16-02-1978 Kakira
MGM/003 Henry Kasujja 14-09-1979 Kakira
MGM/004 Johnson Ludhuba 21-03-1984 Mawoito
MGM/005 Godfreys Kodheyo 0-12-1980 Wairaka
MGM/006 Humprey Makoma 21-08-1974 Musiima
MGM/007 Dicson Kitakufe 19-10-1986 Kakira
MGM/008 Derek Nhala 10-01-1981 Mawoito

Instructions:
Create a table and save it as EMPLOYEE_TAB and enter the data in the table above.

Note: Setting the format for the different fields.


Setting the format for Auto numbers.

e.g.
- Auto number as “MGM/”000
- Date of Birth as DD-MM-YYYY

Prepared by Wejuli Moses and Compiled by Engr. Mulimbi Bricious 2


QUESTION THREE: THE LOOKUP WIZARD AS A DATATYPE
Using a database management software of your choice, create a database and save it as BUSUJJU GP LTD
FishermanId Name Sex DOB Contact District
KLS-001 Mukombozi Alex M 12-12-1980 0772-110110 Wakiso
KLS-002 Kakoma David M 10-02-1978 0777-777777 Soroti
KLS-003 Galama Didas M 01-11-1980 0391-999999 Soroti
KLS-004 Butono Ronald M 04-04-1990 0781-258258 Jinja
KLS-005 Magemeso Peter M 15-10-1989 0421-369369 Jinja
KLS-006 Opeto James M 01-01-1992 0202-547547 Wakiso
KLS-007 Namuga Becky F 06-06-1978 0782-896698 Jinja
KLS-008 Okello Richard M 07-07-1978 0784-565652 Soroti
KLS-009 Kalokore Deus M 09-01-1972 0772-340859 Jinja
KLS-010 Mwoso Patrick M 10-10-1990 0412-369963 Soroti
KLS-011 Apio Sandra F 12-12-1975 0552-587125 Jinja
KLS-012 Alinda Nancy F 10-11-1994 0788-369852 Jinja
KLS-013 Kabanda Isaac M 03-01-1990 0787-236521 Wakiso
KLS-014 Kisakye Vivian F 15-10-1972 0772-555821 Wakiso
KLS-015 Ndagire Mariam F 11-11-1991 0324-258102 Wakiso
KLS-016 Mulokole Michael M 23-12-1987 0800-896658 Soroti
KLS-017 Wamala Emmanuel M 25-12-1990 0336-025552 Jinja
KLS-018 Kamurasi Zeus M 26-04-1995 0772-896562 Jinja
KLS-019 Kisenyi Moses M 29-10-1962 0778-225125 Janja
KLS-020 Nakagolo Annet F 10-10-1990 0202-888213 Wakiso

Instructions:
Create a table and save it as BASIC_DATA
Add the fields with their correct datatypes
Populate the table with the data above.

Note:
Lookup wizard

Prepared by Wejuli Moses and Compiled by Engr. Mulimbi Bricious 3


LESSON 4: QUESTION THREE
Using a database management software of your choice, create a database and save it as LIGHT ACADEMY
Staff No. (Short Text) Surname First name Sex Department Salary
UTS652 Natukunda Emily F Physics 275,000
UTS441 Oloka John M Chemistry 265,000
UTS102 Ababo Benedict M Economics 500,000
UTS333 Among Joyce F Physics 275,000
UTS459 Biriggwa Joshua M Economics 490,000
UTS245 Namagembe Hawa F Chemistry 310,000
UTS134 Nokrack James M Economics 850,000
UTS101 Mwesigwa John M Physics 290,000
UTS376 Osagala Peter M Chemistry 540,000

Instructions:
Create a table and save it as STAFF_TABLE.
Add the fields to the table with their correct datatypes.
Create a form with all the fields and use it to populate the table.

Notes:
Creating a form
Using a form to population the table

Prepared by Wejuli Moses and Compiled by Engr. Mulimbi Bricious 4


LESSON 5: Creating Report based on a Database Table
QUESTION THREE: REPORT
Using a database management software of your choice, create a database and save it as BUSUJJU GP LTD
FishermanId Name Sex DOB Contact District
KLS-001 Mukombozi Alex M 12-12-1980 0772-110110 Wakiso
KLS-002 Kakoma David M 10-02-1978 0777-777777 Soroti
KLS-003 Galama Didas M 01-11-1980 0391-999999 Soroti
KLS-004 Butono Ronald M 04-04-1990 0781-258258 Jinja
KLS-005 Magemeso Peter M 15-10-1989 0421-369369 Jinja
KLS-006 Opeto James M 01-01-1992 0202-547547 Wakiso
KLS-007 Namuga Becky F 06-06-1978 0782-896698 Jinja
KLS-008 Okello Richard M 07-07-1978 0784-565652 Soroti
KLS-009 Kalokore Deus M 09-01-1972 0772-340859 Jinja
KLS-010 Mwoso Patrick M 10-10-1990 0412-369963 Soroti
KLS-011 Apio Sandra F 12-12-1975 0552-587125 Jinja
KLS-012 Alinda Nancy F 10-11-1994 0788-369852 Jinja
KLS-013 Kabanda Isaac M 03-01-1990 0787-236521 Wakiso
KLS-014 Kisakye Vivian F 15-10-1972 0772-555821 Wakiso
KLS-015 Ndagire Mariam F 11-11-1991 0324-258102 Wakiso
KLS-016 Mulokole Michael M 23-12-1987 0800-896658 Soroti
KLS-017 Wamala Emmanuel M 25-12-1990 0336-025552 Jinja
KLS-018 Kamurasi Zeus M 26-04-1995 0772-896562 Jinja
KLS-019 Kisenyi Moses M 29-10-1962 0778-225125 Janja
KLS-020 Nakagolo Annet F 10-10-1990 0202-888213 Wakiso

Instructions:
Create a table and save it as BASIC_DATA
Add the fields with their correct datatypes
Populate the table with the data above.
Note:
Lookup wizard

Prepared by Wejuli Moses and Compiled by Engr. Mulimbi Bricious 5


LESSON 6: Formatting a Database Report
In the previous lesson you created a report and it was viewed in a report view. In the next lesson you will modify the report so as to look
professional. All the modification should be done in Design View. For Example:
- Let all the report headers be bold.
- Change the font colour of the report headers.
- Change the fill colour of the holders of the report headers.
- In details section change font colour.
- In details section change the fill colour.
You can also choose to add the headers and the footers. Simply right-click on the working space and select header. A report can be changed in any
way you want.
- Right click on the report working area and choose to add the header and the footer.
- In the report header you may use a lable from the Design Tab to add the heading of this report.
- You may choose to increase the font size, centre align, font colour and bold the heading.
- You do the same with the page footer or report footer.

Prepared by Wejuli Moses and Compiled by Engr. Mulimbi Bricious 6


Database Tutorial 7: Form Controls, Form buttons and Popup Forms
- In this tutorial we are going to look at how to add controls to the form and also how to make a form to look like a form as a popup.
- Remember in this case the Form still remains an object of the database but when it appears it appears like an independent object.
- Open the previous form for LIGHT ACADEMY where a Staff table and Entry Form were created in this database. However, our many
focus of this tutorial is how to ADD Controls to the form.
- Remember to add anything to the form it has to be done in Form Design View. Minimise the Form area to be small for neatness.
- Click on the Design Tab and under Controls group ADD Buttons. Pick a button and draw it down. When you draw the button the
Command Button Wizard will appear that contain several categories with their actions that can be assigned to the button. Go on to assign
actions depending on the Database Form design. Add more buttons to your form.
- The other thing is to make the form a popup object. Click on Property Sheet under Tools group. Remember if you click on any object of
the form it will bring properties for that particular object. But now click on the Form Area to activate Form Property Sheet and choose
ALL on the Property Sheet Tabs. Click on the drop down button to display more options and choose Form. Look for the word Popup and
choose the option yes. Click on View the Form in Home Tab under Views group.
- Now, test the buttons if they are working. That’s how you add the buttons to the Form or Report.

Prepared by Wejuli Moses and Compiled by Engr. Mulimbi Bricious 7


TUTORIAL 8: QUERIES
- Text queries
- Number queries
- Date queries
- Wild cards
1. What is a query? A query is a question we ask database in case we want particular data to be retrieved. For example, in a school database
if we want to retrieve a particular student. We will create a query using the BUSUJJU GP LTD.
QUESTION THREE: REPORT
Using a database management software of your choice, create a database and save it as BUSUJJU GP LTD
FishermanId Name Sex DOB Contact District
KLS-001 Mukombozi Alex M 12-12-1980 0772-110110 Wakiso
KLS-002 Kakoma David M 10-02-1978 0777-777777 Soroti
KLS-003 Galama Didas M 01-11-1980 0391-999999 Soroti
KLS-004 Butono Ronald M 04-04-1990 0781-258258 Jinja
KLS-005 Magemeso Peter M 15-10-1989 0421-369369 Jinja
KLS-006 Opeto James M 01-01-1992 0202-547547 Wakiso
KLS-007 Namuga Becky F 06-06-1978 0782-896698 Jinja
KLS-008 Okello Richard M 07-07-1978 0784-565652 Soroti
KLS-009 Kalokore Deus M 09-01-1972 0772-340859 Jinja
KLS-010 Mwoso Patrick M 10-10-1990 0412-369963 Soroti
KLS-011 Apio Sandra F 12-12-1975 0552-587125 Jinja
KLS-012 Alinda Nancy F 10-11-1994 0788-369852 Jinja
KLS-013 Kabanda Isaac M 03-01-1990 0787-236521 Wakiso
KLS-014 Kisakye Vivian F 15-10-1972 0772-555821 Wakiso
KLS-015 Ndagire Mariam F 11-11-1991 0324-258102 Wakiso
KLS-016 Mulokole Michael M 23-12-1987 0800-896658 Soroti
KLS-017 Wamala Emmanuel M 25-12-1990 0336-025552 Jinja
KLS-018 Kamurasi Zeus M 26-04-1995 0772-896562 Jinja
KLS-019 Kisenyi Moses M 29-10-1962 0778-225125 Janja
KLS-020 Nakagolo Annet F 10-10-1990 0202-888213 Wakiso

Prepared by Wejuli Moses and Compiled by Engr. Mulimbi Bricious 8


How to create a query
- A query is created from the CREATE TAB on the Microsoft Access Ribbon. In this case we use the Query design tool in the queries
group.
- Click on the Query design tool to have the Query design interface or environment. The interface is displayed with a Show Table dialogue
box with the following tabs: Tables, Queries and Both. Practice by clicking on these tabs to see what happens.
- This means you can create a Query from a Table, Query or from Both. In this tutorial click on BASIC DATA table to add the table and
then close the SHOW TABLE dialogue box.

- If you check the BASIC DATA table you will see that all the fields are there: FISHERMANID, NAME, SEX, DOB, CONTACT and
DISTRICT.
- Depending on the query you are creating, to add fields to GRID you simply double click on field names in the table.

Prepared by Wejuli Moses and Compiled by Engr. Mulimbi Bricious 9


Tutorial 9: Running Text Queries in a Microsoft Access Database
QUESTION NINE: TEXT QUERIES
Using a database management software of your choice, create a database and save it as BUSUJJU GP LTD
FID FNAME SNAME SEX DOB CONTACT DISTRICT
KLS-001 Mukombozi Alex M 12-12-1980 0772-110110 Wakiso
KLS-002 Kakoma David M 10-02-1978 0777-777777 Soroti
KLS-003 Galama Didas M 01-11-1980 0391-999999 Soroti
KLS-004 Butono Ronald M 04-04-1990 0781-258258 Jinja
KLS-005 Magemeso Peter M 15-10-1989 0421-369369 Jinja
KLS-006 Opeto James M 01-01-1992 0202-547547 Wakiso
KLS-007 Namuga Becky F 06-06-1978 0782-896698 Jinja
KLS-008 Okello Richard M 07-07-1978 0784-565652 Soroti
KLS-009 Kalokore Deus M 09-01-1972 0772-340859 Jinja
KLS-010 Mwoso Patrick M 10-10-1990 0412-369963 Soroti
KLS-011 Apio Sandra F 12-12-1975 0552-587125 Jinja
KLS-012 Alinda Nancy F 10-11-1994 0788-369852 Jinja
KLS-013 Kabanda Isaac M 03-01-1990 0787-236521 Wakiso
KLS-014 Kisakye Vivian F 15-10-1972 0772-555821 Wakiso
KLS-015 Ndagire Mariam F 11-11-1991 0324-258102 Wakiso
KLS-016 Mulokole Michael M 23-12-1987 0800-896658 Soroti
KLS-017 Wamala Emmanuel M 25-12-1990 0336-025552 Jinja
KLS-018 Kamurasi Zeus M 26-04-1995 0772-896562 Jinja
KLS-019 Kisenyi Moses M 29-10-1962 0778-225125 Janja
KLS-020 Nakagolo Annet F 10-10-1990 0202-888213 Wakiso

Instructions:
Create a table and save it as BASIC_DATA
Populate the table with the data above.
Create a query to display
(a) People whose FNAME starts with letter K, save it as ‘letter k’
(b) People whose SNAME ends with letter S, save it as ‘letter S’

Prepared by Wejuli Moses and Compiled by Engr. Mulimbi Bricious 10


(c) People with letter A anywhere in the middle of their FNAME, save it as ‘letter A’
(d) People who are from Wakiso, save it as ‘Wakiso’
(e) People who are not from Wakiso, save it as ‘Not Wakiso’
Note: in queries there is something that we call Criteria. A Criteria is like what you have to follow or what Database will follow in order to
return what you want exactly. For example, in question (a) above the Criteria is “FNAME letter k. This will look like the diagram below:

Then click OK and RUN! The query will be displayed. Save the query as letter k and close off the query tab.
In question (b) the display will look like this…

Prepared by Wejuli Moses and Compiled by Engr. Mulimbi Bricious 11


In Question (c) the Criteria is *A*. This means the letter is anywhere in the middle of the name. Then RUN the query to display data.
In Question (d) the Criteria is WAKISO. This means only people from WAKISO. Then RUN the query and save the query.
In Question (e) the Criteria is NOT WAKISO or you can use the symbols <>WAKISO. This means people not in WAKISO.

Prepared by Wejuli Moses and Compiled by Engr. Mulimbi Bricious 12


Number Queries in Microsoft Access Databases
TUTORIAL TEN: NUMBER, CURRENCY QUERIES
Open a suitable database program of your choice and key in the following details. Save your database as Canteen Sales 2020.

Database Structure
Field name Field format
ItemID SJV-@@@
Item name -
Unit price “ZMW”#,###
Quantity #,###
DOS DD-MMM-YYYY
Location -

Table 1: Item table 2020


ItemID Item Name Quantity Unit Price DOS Location
001 Half cake 600 200 12-Feb-2020 A
010 Doughnut 1200 200 05-Feb-2020 A
090 Chapatti 400 500 13-Apr-2020 B
070 Mandazi 1430 250 02-Mar-2020 A
081 Soda 800 800 15-Jan-2020 B
071 Yorghut 2100 600 11-Jun-2020 B
100 Kebab 3000 450 10-Feb-2020 A
101 Sausages 700 500 10-Jan-2020 B
060 Bagiya 400 1500 13-Apr-2020 A
045 Exercise books 1000 1500 20-Mar-2020 A
200 Pen 600 500 22-Feb-2020 B
004 Torches 410 3000 16-Oct-2020 B
008 Safi 745 2000 12-May-2020 B
094 Zuri 800 2500 15-Mar-2020 B
007 Sweets 8000 200 30-May-2020 A
124 Irish 100 500 22-Jan-2020 A

Prepared by Wejuli Moses and Compiled by Engr. Mulimbi Bricious 13


183 Ruler 400 1000 17-Jun-2020 B
400 Sumbi 1000 250 12-Jan-2020 A
320 Biscuits 900 1500 18-Mar-2020 A
210 Minute maid 250 2500 20-Apr-2020 A

Instructions:
Create a query to display the following:
(a) Items with quantity above 500, save it as ‘Above 500’
(b) Items whose quantity is between 800 and 2000, save it as ‘between’
(c) Items with quantity below 1000, save it as ‘below 1000’
(d) Items that cost less 1000, save it as ‘less than 1000’
(e) Items that cost 700 and below, save it as ‘700 and below’
(f) Items whose price is more than 1000, save it as ‘more than’
(g) Items that cost exactly 1500, save it as ‘exactly 1500’

Solutions
(a) In question (a) click on CREATE Tab and go to Query Design. Add table. To create a query with Items with quantity above 500, insert
>500 in Criteria under Quantity Field and then RUN the query. Save the query.
(b) In question (b) in the same quantity field insert ‘between 800 and 2000’ RUN the query. Save the query.
(c) In question (c) in the same quantity field insert ‘<1000’ RUN the query. Save the query.
(d) In question (d) in the Unit Price field insert ‘<1000’ RUN the query. Save the query.
(e) In question (e) in the Unit Price field insert ‘<=700’ RUN the query. Save the query.
(f) In question (f) in the Unit Price field insert ‘>1000’ RUN the query. Save the query.
(g) In question (g) in the Unit Price field insert ‘=1500’ RUN the query. Save the query.
END OF QUESTION

Prepared by Wejuli Moses and Compiled by Engr. Mulimbi Bricious 14


Date Queries in Microsoft Access Databases
TUTORIAL ELEVEN: DATE QUERIES
Open a suitable database program of your choice and key in the following details. Save your database as Canteen Sales 2020

Database Structure
Field name Field format
ItemID SJV-@@@
Item name -
Unit price “ZMW”#,###
Quantity #,###
DOS DD-MMM-YYYY
Location -

Table 1: Item table 2020


ItemID Item Name Quantity Unit Price DOS Location
001 Half cake 600 200 12-Feb-2020 A
010 Doughnut 1200 200 05-Feb-2020 A
090 Chapatti 400 500 13-Apr-2020 B
070 Mandazi 1430 250 02-Mar-2020 A
081 Soda 800 800 15-Jan-2020 B
071 Yorghut 2100 600 11-Jun-2020 B
100 Kebab 3000 450 10-Feb-2020 A
101 Sausages 700 500 10-Jan-2020 B
060 Bagiya 400 1500 13-Apr-2020 A
045 Exercise books 1000 1500 20-Mar-2020 A
200 Pen 600 500 22-Feb-2020 B
004 Torches 410 3000 16-Oct-2020 B
008 Safi 745 2000 12-May-2020 B
094 Zuri 800 2500 15-Mar-2020 B
007 Sweets 8000 200 30-May-2020 A
124 Irish 100 500 22-Jan-2020 A

Prepared by Wejuli Moses and Compiled by Engr. Mulimbi Bricious 15


183 Ruler 400 1000 17-Jun-2020 B
400 Sumbi 1000 250 12-Jan-2020 A
320 Biscuits 900 1500 18-Mar-2020 A
210 Minute maid 250 2500 20-Apr-2020 A

Instructions:
Create a query to display the following:
a) Items that were sold in the month of February, save it as ‘February’
b) Items that were sold before April, save it as ‘before April’
c) Items that were sold after April, save it as ‘After April’
Solutions:
a) In question (a) in the DOS (Date of Sale) field criteria insert ‘Month([DOS])=2’ RUN the query. Save the query.
b) In question (b) in the DOS (Date of Sale) field Criteria insert ‘Month([DOS])<4’ RUN the query. Save the query.
c) In question (b) in the DOS (Date of Sale) field Criteria insert ‘Month([DOS])>4’ RUN the query. Save the query.

Prepared by Wejuli Moses and Compiled by Engr. Mulimbi Bricious 16


TUTORIAL TWELVE: DATE CRITERIA (DATE QUERIES)
The table below gives information on some staff members of a computer school called “COMTECH ACADEMY”
EMPLOYEE TABLE
Id. No. First name Surname sex title Dept Salary DOB
ZL001 Akello Jessica F Chief worker Management 730000 18/06/1957
ZL040 Musoke Julian F Worker Kitchen 630000 05/08/1978
ZL071 Lubega Zak M Worker Kitchen 700000 05/06/1972
ZL160 Katiti Ann F Secretary Research 3850000 19/06/1937
ZL178 Mulondo James M Worker Kitchen 600000 14/05/1964
ZL180 Musisi Jonathan M Director Management 1200000 18/08/1977
ZL185 Mirembe Emily F Cashier Management 700000 14/05/1969
ZL220 Andama Jacob M Driver Management 375000 17/06/1964
ZL230 Buirungi Juliet F Secretary Information Technology 385000 19/08/1971
ZL340 Opio Amin M Librarian Research 420000 08/12/1975

Instructions:
Create queries that will return the following:
(a) Employees who were born before 1970, save it as ‘born before 1970’
(b) Employees who were born after 1960, save it as ‘born after 1960’
(c) Employees who are above 50 years, save it as ‘above 50 years’
(d) Employees who are below 50 years, save it as ‘below 50 years’
(e) Employees born between 1960 and 1970, save it as ‘born between 1960 and 1970’
Solutions:
(a) In question (a) in the DOB field Criteria insert ‘YEAR([DOB])<1970’ or the other way is insert ‘DatePart(“yyyy”,[DOB])<”1970” RUN
the query. Save the query.
(b) In question (b) in the DOB field Criteria insert ‘YEAR([DOB])>1960’ or the other way is insert ‘DatePart(“yyyy”,[DOB])>”1960”
RUN the query. Save the query.
(c) In question (c) CREATE A NEW FIELD and use the Function called DATEDIFF in GRID PANE AREA insert
‘AGE:DATEDIFF(“YYYY”,[DOB],NOW()). In the Criteria of AGE field insert ‘>50’ RUN the query. Save the query.
(d) In question (d) in the Criteria of AGE field insert ‘<50’ RUN the query. Save the query.
(e) In question (e) in the Criteria of DOB field insert ‘YEAR([DOB]) BETWEEN 1960 AND 1970’ RUN the query. Save the query.

Prepared by Wejuli Moses and Compiled by Engr. Mulimbi Bricious 17


TUTORIAL THIRTEEN: DATE QUERIES
Open a suitable database program of your choice and key in the following details. Save your database as Canteen Sales 2020.
Table 1: Item table 2020
ItemID Item Name Quantity Unity Price DOS
CLA/001 Half cake 600 200 12-Feb-2020
CLA/002 Doughnut 1200 200 05-Feb-2020
CLA/003 Chapatti 400 500 13-Apr-2020
CLA/004 Mandazi 1430 250 02-Mar-2020
CLA/005 Soda 800 800 15-Jul-2020
CLA/006 Yorghut 2100 600 11-Jun-2020
CLA/007 Kebab 3000 450 10-Feb-2020
CLA/008 Sausages 700 500 10-Jan-2020
CLA/009 Bagiya 400 1500 13-May-2020
CLA/010 Exercise books 1000 1500 20-Sep-2020
CLA/011 Pen 600 500 22-Jul-2020
CLA/012 Torches 410 3000 16-Oct-2020
CLA/013 Safi 745 2000 12-May-2020
CLA/014 Zuri 800 2500 15-May-2020
CLA/015 Sweets 8000 200 30-Aug-2020
CLA/016 Irish 100 500 22-Jan-2020
CLA/017 Ruler 400 1000 17-Sep-2020
CLA/018 Sumbi 1000 250 12-Jan-2020
CLA/019 Biscuits 900 1500 18-Oct-2020
CLA/020 Minute maid 250 2500 20-Apr-2020
CLA/021 Popcorn 300 1000 12-May-2020
CLA/022 Gorrilo 650 1500 20-Apr-2020
CLA/023 Nuddles 500 2000 13-Nov-2020
CLA/024 Pads 300 2500 28-Jul-2020
CLA/025 Handkerchief 800 1500 12-Dec-2020
CLA/026 Stockings 200 2000 24-Oct-2020
CLA/027 Watches 100 20000 20-Nov-2020

Prepared by Wejuli Moses and Compiled by Engr. Mulimbi Bricious 18


CLA/028 Mathematical set 280 2500 30-Sep-2020
CLA/029 Chocolate 1000 500 20-Apr-2020
CLA/030 lato 200 2500 11-Apr-2020
Instructions:
Create a query that will display the following:
a) Items that were sold in the first quarter of the year, save it as ‘quarter 1’
b) Items that were sold in the month of August, save it as ‘August’
c) Items that were sold between April and September, save it as ‘between’
d) Items that were sold either on 20/April/2020 or 12/may/2020
e) Items that were sold on any other day other than 20/April/2020
f) Items that were sold in the previous 30 or 31 days.
Solutions:
a) In question (a) in the DOS field Criteria insert ‘Datepart(“Q”,[DOS])=1’ RUN the query. Save the query.
b) In question (b) in the DOS field Criteria insert ‘Month([DOS])=8’ or use the Criteria ‘Datepart(“M”,[DOS])=8’ RUN the query. Save
the query.
c) In question (c) in the DOS field Criteria insert ‘>1/4/2020 AND <30/9/2020’ or insert ‘MONTH([DOS])>=4 AND
MONTH([DOS])<=9’RUN the query. Save the query.
d) In question (d) in the DOS field Criteria insert ‘20/4/2020 OR 12/05/2020’ RUN the query. Save the query.

Prepared by Wejuli Moses and Compiled by Engr. Mulimbi Bricious 19


e) In question (e) in the DOS (Date of Sale) field criteria insert ‘NOT 20/4/2020’ RUN the query. Save the query.
f) In question (a) in the DOS (Date of Sale) field criteria insert ‘Month([DOS])=Now()Month([DOS])=Month([Now()])-1’ RUN the query.
Save the query.
END

Prepared by Wejuli Moses and Compiled by Engr. Mulimbi Bricious 20


TUTORIAL FOURTEEN: CALCULATIONS IN QUERIES AND DATA IMPORTING
CALCULATED FIELDS
StudentId Name Sex MTC ENG SCIE SST
BFPS/001 Musubika E F 80 90 15 100
BFPS/002 Asiimwe L F 90 90 45 89
BFPS/003 Zirintusa A M 100 56 98 100
BFPS/004 Mukembo M M 100 100 58 97
BFPS/005 Nalubwama A F 89 89 56 41
BFPS/006 Naiga S F 100 100 15 98
BFPS/007 Walusimbi S M 58 98 65 64
BFPS/008 Galiwango I F 78 98 56 45
BFPS/009 Kayemba F F 89 98 89 100
BFPS/010 Musita M M 100 56 89 74
BFPS/011 Ikendi D M 56 89 74 51
BFPS/012 Mawalo M M 56 89 74 51
BFPS/013 Nsubuga K F 100 56 98 45
BFPS/014 Waiswa C M 56 98 98 100
BFPS/015 Mulengani V M 96 56 100 56

Data Importing
How to import data into the database.
- Make sure that the data to be imported in typed in excel. Note: Data importing in Microsoft Access is not done in Word Processor but data
should be in Excel.
- Therefore, in this case type the above table of data in Microsoft Excel. Give it any name you want, for Import and close it.
- Start the database, in this case you are going to create a new database, give it any name for example, STARLIGHT ACADEMY.
- This is a database without any table. In this case, delete the default table 1 so as it remains a blank database without any table.
- To import data, Click on External Data Tab, then click on excel. This means you are importing data from excel.
- A popup dialogue box will open “Get External Data – Excel Spreadsheet”. Locate your data on where you had save it.
- After locating your excel data, CLICK on “Import the source data into a new table in the current database”. Click OK.
- “Import Spreadsheet Wizard” will pop up, CLICK Next.
- Edit the data type on the next dialogue box “Import Spreadsheet Wizard”. Click Next.
- On the next “Import Spreadsheet Wizard” Choose “CHOOSE MY OWN PRIMARY KEY”. Click Next.
- What will be the table be called? Give it a name. For example, “STUDENT MARKS”. Then click finish and close the dialogue Wizard.
We have finished importing the data into the database.

Prepared by Wejuli Moses and Compiled by Engr. Mulimbi Bricious 21


Let’s now look at the below instructions.
Instructions:
Create a form that will display all the results of all students, add a field for total and calculate the total score for every student
Create a query to display the total scores for all the students in class.
- Step 1: Create a form, using the Form Design under Design Tab.
- Step 2: Add a field for Total. Use a Text Box under Controls Group. Draw it underneath the other fields.

Prepared by Wejuli Moses and Compiled by Engr. Mulimbi Bricious 22


- Step 3: Insert the Formular as indicated above, =[MTC]+[ENG]+[SCIE]+[SST]. Click on Form View. Save it as calculation form.
Create a query
- Go to CREATE TAB, then Query Design. Add the fields to the GRID.
- Create a New Field in the GRID. “TOTAL:[MTC]+[ENG]+[SCIE]+[SST]. After that click OK.
- RUN the query. Save the query.

Prepared by Wejuli Moses and Compiled by Engr. Mulimbi Bricious 23


TUTORIAL FIFTEEN: MORE CALCULATIONS IN DATABASE QUERIES
Using and Database application of your choice, design a Website and save it as SURE MEDICAL CLINIC
WID NAME DOB PREFESSION SALARY ALLOWANCE DURATION TOTAL TAX TOTAL NEW INCREASE
(PER DAY) (DAYS) ALLOWANCE PAY SALARY
(PER DAY)
200701 Mulimbi 1/16/1970 Technician 700000 120000 3
200702 Mulauzi 2/17/1978 Doctor 2000000 170000 2
200703 Lubinda 3/20/1979 Driver 500000 100000 1
200704 Nanyinza 12/1/1977 Nurse 1200000 150000 3
200705 Otale 5/5/1980 Driver 450000 100000 1
200706 Nakamba 2/17/1972 Nurse 1000000 150000 2
200707 Mulungu 7/3/1973 Technician 650000 120000 3
200708 Olipa 7/20/1969 Doctor 1700000 170000 2
200709 Namuchimba 2/19/1978 Nurse 900000 150000 1
200710 Omondi 9/22/1969 Nurse 1000000 150000 2

Create a table and save it as STAFF DATA, use the data in the table above to populate the table: STAFF DATA
Given that Tax is calculated as 15% of the salary, and salary in the following year is increased by 10% of the total salary in the previous year;
Create a query that will return:
a. Total allowances earned by every staff member, save it as STAFF ALLOWANCES
b. The tax deducted from every member’s salary, save it as TAX
c. Total amount earned by every STAFF MEMBER, save it as TOTAL PAY
d. New salary earned by every member in the new year, save it as NEW SALARY
e. The increase from the old to the new salary, save it as INCREASE
Create a query that will automatically update the table filling up the empty fields.
Solutions:
- In Question (a) create a query by CLICKING CREATE TAB – Query Design – add the fields as shown below.

Prepared by Wejuli Moses and Compiled by Engr. Mulimbi Bricious 24


- Under the field header name, TOTAL ALLOWANCE enter the formula [ALOWANCE ([PER DAY)]*[DURATION (DAYS)]. Run the
query. Save the query as Allowances and close it off.
- In Question (b) CREATE a query by adding the fields as shown below.

Prepared by Wejuli Moses and Compiled by Engr. Mulimbi Bricious 25


- RUN the query. Save the query as Tax and close it off.
- In Question (c) CREATE a query by adding the fields as shown below.

Prepared by Wejuli Moses and Compiled by Engr. Mulimbi Bricious 26


Prepared by Wejuli Moses and Compiled by Engr. Mulimbi Bricious 27
Prepared by Wejuli Moses and Compiled by Engr. Mulimbi Bricious 28
- Run the query. Save the query as Total Pay and close it.
- In Question (d) and (e) CREATE a query as shown below.

Prepared by Wejuli Moses and Compiled by Engr. Mulimbi Bricious 29


Prepared by Wejuli Moses and Compiled by Engr. Mulimbi Bricious 30
- RUN the Query and Save it.
- Create a query that will automatically update the table filling up the empty fields. This is called an update query.
- Click on CREATE TAB – Query Design to create a query. Add all the fields of the STAFF Table.
- Click on Design Tab and click on UPDATE command. In the Update to follow the procedure as shown below.

Prepared by Wejuli Moses and Compiled by Engr. Mulimbi Bricious 31


Prepared by Wejuli Moses and Compiled by Engr. Mulimbi Bricious 32
Prepared by Wejuli Moses and Compiled by Engr. Mulimbi Bricious 33
Prepared by Wejuli Moses and Compiled by Engr. Mulimbi Bricious 34
Prepared by Wejuli Moses and Compiled by Engr. Mulimbi Bricious 35
- RUN the Update to Query to see if all the blank boxes have been filled up. Save the query as UPDATE QUERY and close it.
- Open the STAFF Table to see if the blanks boxes have been filled up.
- Change the currency to be in general not in a dollar ($) sign. You do this by opening the STAFF Table in DESIGN view.

Prepared by Wejuli Moses and Compiled by Engr. Mulimbi Bricious 36


- Save the changes and open the STAFF Table to view the format of fingers.
GOD BLESS YOU AS YOU ENDEAVOUR TO BE NEXT DEVELOPER

Prepared by Wejuli Moses and Compiled by Engr. Mulimbi Bricious 37

You might also like