Download as pdf
Download as pdf
You are on page 1of 11
Module 4 Databases for a Purpose Learning Objectives ‘ . Pass/ Student is able to: Merit 1 |Identify a purpose for a database P 2 Design, create and develop a database Pp for a specific purpose 3 | Utilise different field types P 4 |Test database M 5 Demonstrate an awareness of M data security 6 | Transfer data between applications M 42. Databases for a Purpose 4.1 Databases Designing databases \ ® Aschool computer club wants to collect data on the usage of the Internet among, its members. You are asked to design a database to keep the data’and to retrieve relevant information from time to time. * The data collected will be kept confidential and only the main users, the Chairman, the Secretary and the Treasurer are allowed access. ° From the database collected, they would like to know: © the highest usage in hours per day © boys using dial-up connection © girls accessing the Internet for more than 3 hours. ean Sco 2 _____ Discuss with your frionds the key fields that are required and design a simple data entry form to be distributed to the members of the school computer club. The following are some examples of key fields: © Member ID Name Sex Age ‘Type of connection to Internet (dial-up or broadband) Average daily usage in hours Date first subscribed to Internet Service Provider (ISP). Ce) ° Data entry form * Design a simple data entry form to be distributed to the members to collect data from them. (Signature) Computer Club Sri Mawar Primary School Survey on Internet Usage at Home a. Member ID: b. Name: c. Sex: (Write M for Male and F for Female) d. Age: e. Type of connection to Internet: __ (Write D for Dial-up, B for Broadband, and O for Other) f. Average daily usage: hours g. Date first subscribed to ISP:___/_/ (DD/MM/YYYY) (Date) Databases for a Purpose 43 4.2 Data structure enna ens —_\ Data structure © Click @ to open Start menu. © Click > AllPrograms. © Click G2: Microsoft Office Access 2007. © CICK Tbe” ® Select your own directory or folder. * Type internetusage’ as the filename. © Click. to create the database. Creating a table * Under the create tab, click 5 ‘Table * Click on the arrow below ILL}, click [2 acim ves view and enter a name for the taste you are about to create. Click ° Set up the table with the following details/options. Field Name [Datatype [Field Properties MemberID Text 3 Name of member [Text 50 For the field Sex Text 4 Usage, set Age Number Long Integer the decimal Connection Text 4 places to 1. -|Usage Number [Decimal / Dale Subscribed [Date/Time _|- Data type * The dala type determines the kind of values. that users can store in the field. © Text ~ Text or combination of text and numbers, including numbers that do not require calculation. © Memo — Lengthy text or combinations of text and numbers. © Number ~ Numeric data used in calculations, © Date/Time — Date and time values. © Currency — Currency values and numeric data used in calculations. 4.3 Primary key / carving Oijeae2 Primary key * Agood and effective database should include a field or set of fields that ' uniquely identifies each record stored in| the table. This information is called the primary key of the table. Once you set | a primary key for a table, Access will | * Asmall key icon!» will appear in the Tools group on the Design tab, indicating that the field has been set as the primary key. prevent any duplicate or null values from being entered in the primary key fields. ® Select the field MemberlD and click |?» at the menu toolbar. Saving the table © Click (Bi! to open Office menu. + Click [S smeas and select [BK Zan © Save the table as internetusage. © Click(__ ox). Entering data \ ® Click to select the table [jie Internet Usage. CMe | oe © Key-in the given 2 dete: een ws [ae — © To ensure data consistency, you will only enter Sex as M or F and enter connection as 8 for Broadband, D for Dial-up and © for Other. * The format of data entered must be consistent. Dial-up is considered different from Dial up; Broad Band differs from Broadband. MemberID: 001 MemberID: 002 Name: William Teo Name: Phua Chu Meng ‘Sex: M ‘Sex: M Age: 15 Age: 16 Connection: D Connection: B Usage: 2.5 hrs Usage: 5 hrs Date Subscribed: 02/01/2010 Date Subscribed: 01/07/2010 Databases fora Purpose 45 Record 3 to 12 / Leaming Objecive: \ MemberID: 003 Name: Elizabeth Goh Sex: F ' Age: 13 Connection: B Usage: 8 hrs Date Subscribed: 15/02/2019 MemberID: 008 ‘Name: Limalawati Hassan Sex: F Age: 16 Connection: D Usage: 2 hrs Date Subscribed: 03/08/2008 MemberID: 004 Name: Mohad. Aziz ‘Sex: M Age: 17 Connection: D Usage: 1 hrs Date Subscribed: 31/19/2011 MemberID: 009 ‘Name: Bruce Lee Sex: M Age: 17 Connection: B Usage: 8 hrs Date Subsoribed: 01/03/2012 MemberlD: 005 Name: Maty Peter Sex: F Age: 16 Connection: D Usage: 4 hrs Date Subseribed: 07/05/2009 MemberlD: 010 Name: Jong Ah Lai Sex: M Age: 14 Connection: B Usage: 8 hrs Date Subscribed: 15/06/2011 MemberID: 006 Name: Fatimah Ali Sex: F Age: 12 Connection: B ‘Usage: 5 hrs Date Subscribed: 15/12/2012 MemberlD: 014 ‘Name: Betty Victoria Sex: F Age: 15 Connection: 8 Usage: 7 hrs Date Subscribed: 18/11/2011 MemberID: 007 Name: Siti Noraliza Sex: F Age: 15 Connection: D Usage: 5 hrs Date Subscribed: 01/02/2009 MemberID: 019 ‘Name: Henry Joseph Sex: Age: 16 Connection: B Usage: 6.5 hrs Date Subscribe : 19/10/2011 46 Databases for a Purpose / Learning Objectives: 2,3 \ Records 13, 14 and 15 Member!D: 013 nme Boniface David MemberID: 014 ex: ‘i . Age: 16 NATE: ANDER YE MemberlD: 015 Connection: D eM Name: Lai Fatt Cai : ee Sex: M Uesties') hes Connection: B os Date Subscribed: 15/09/2010 U: : 6 hes Age: 15 are Subscribed: onvoavoory | Connestion: B Date Subscribed: 08/08/0011_| Tyehew gs Date Subscribed: 05/12/2011 Retrieve information \ Supply the information required when you were first asked to set up the database. The first information: The highest usage in hours per day. This information can be retrieved easily. Open the table. Click any cell in the column Usage. Click 4 to sort the data in descending order. After sorting, the number that appears. ~ at the top indicates the highest usage in hours, that is, 8 hours. Using a filter ‘You can create a filter to find the information on: Boys that use dial-up connection. On the Home tab, in the Sort & Filter group, click VejAdvanced ~. Click ¥iqj) Ellter By Form, ey ‘eee ome Bes ‘eee a FH mio Select M in the column Sex. Select D in the column Connection. Mea Bo 2 uaa [ean sae Tow coe Click S¥ Togale Filter to apply the filter and then olick SF Togale Filter again to see alll the records. Databases for a Purpose 47 4.4 Query / tearing Objective: \ Query * Create a query for the third information required: Girls that access the Internet for more than 3 hours. . © Close the table by clicking on the [i on the right hand side of the table. * On the Create tab, in the Other group, click 3°. * Choose Smear wierd and click [2], Wzare © Click 2.) to select all the fields. © Click (L.uest>s. ° kk aati I, © Click © Type internetusagequery-girsuse>3h as the name of the query. © Click @ faite aie deen," Simple Query Wizard \ Change the query ® Inthe column Sex, type “F”. net every day! © Inthe column Usage, type >3. + ote | onnne query. Se aun ‘oa | Lad —= >| Talso spend Wt Se Enel nacenlEneanlil omraditttiocaifnacaleatetet. pice ais Fen er nnn hours surfing the i? 48 Databases for a Purpose Res sult of query The result of the query shows that there are 5 girls who use the Internet for more than 3 hours every day! ‘Date Subscrib = [Elizabeth Goh F BB 8 (2/18/2012 Betty Vicors 158 7 au/se/2001 ‘Siti Noralize F 15D | 5 1/2/2003, Fatimah Ali, F 2B 5 12/15/2012, | Mary Peter F 16D 4 ‘7/5/2008 Bi Records fiefs [> Wms] ene Ftee [Seren — ] i hunicc [ww eu lig Other queries You can always change the query for other information. Find out: Who are stil using dial-up connection? Select internetusage Query — girls use>3h and click [i] asiceven, Delete the criteria in the columns Sex and Usage. © Type Din the column Connection in the row for Criteria. Uncheck the check-box for the fields MemberlD, Sex and Date Subscribed so that we have information on Name, Age, Connection and Usage only. Save the query as dial-upusers. tick to run the query. fm Queries exercises Create a new query using the Query Wizard to search for information on: © The Broadband users; save the query as broadbandusers. © Boys who are more than 15 years old and used the Internet for more than 5 hours; save your query as boys>15yrs>5h. © Users who are less than 14 years old; save your query as youngusers. ‘Change the broadbandusers query to find out who used Broadband before the year 2005; save the query with a suitable name. (Hint: type <#01/01/201# in the column Date Subscribed for Criteria) Modify the boys>15yrs>5h query to find out girls who are more than 16 years old and use the Internet or more than 4 hours; save the query with a suitable name. Modify the youngusers query to find out who use the Internet for more than 7 hours per day; save the query as heavyusers. Databases fora Purpose 49 4.5 Exporting information [roaming Objece:6 Export to MS Excel * Open the query dial-upusers from the previous exercise. ° Click on External Data tab. heeeeteti : ———— ° Inthe Export group, click ni seer] ° Select the folder you intend to save the exported ne information in, ee © Check the option fg i a Fc © Change the File Format to festa) — © Click (3K). © Load (Xi) Micro oc exc! 2007 * Open the file dial-upusers.xlxs, * Plot a column chart on Dial-up Users by Usage with: © Chart ttle: Dial-up Users © Category (X-axis): Names © Value (Y-axis): Usage Per Day in Hours. Remove the legend. Place the graph under the data table. Draw another graph Users by Age. Use a suitable title and labels. Place the graph below the first graph. Export to MS Word © Change the broadbandusers query so that | it shows only Broadband users who are less. than 15 years old. © Save the query as bb_below/5yrs. The file is saved as as type (ciUeer\systen-aDesteotnenTextrormat tt [=] * You can save it again in the docx format. * Click on External Data tab. M © Inthe Export group, click & Word , : * Select the folder you intend to save the | fieeoie Tra a exported information in. + ona Ah ial |oa ia ° Click | BettyVietoriaF 1s } Henrylosenh = M 16 {Anthony Yan Mt 2 {irae M 5 50 Databases for a Purpose 6 Data security / earning Objective: Zz Data back-up © To prevent loss of data, you must always save back-up copies of the database. For very important * You can use the same filename or a new database, like in filename. , banks, the back-up * Save the file in other storage devices like itles are.even kept in USB thumb or pen drive, CD or any other a separate building suitable devices. to prevent data loss in case of fire! ° The back-up files must not be stored in the same room as the original data files. Database password \ © Passwords can be used to prevent unauthorised persons from reading the data. I | na * Before you can apply a database a | Bt password, the database must be opened *ma nie P ie ease in the Exclusive mode. * Select internetusage.acodb from the folder. * Click on Database Tools tab. © Click @% Enerpt with Password ° Type a password of your own choice. © Retype the exact password to verily. * Click (ok). User and group Permissions * Select internetusage.mdb file from the For the final assessment, folder. er si , students are NOT required * Inthe Administrator group, click - to show their computer skills * You can then set permissions for ‘ in setting passwords or different users to access or perform permissions. However, they different tasks to the table or queries. are required to mention at least one security measure You can apply user and to prove that they are aware group permissions to your of data security. database only when it has been saved as a .ndb file. Databases for a Purpose 51 Module 4 — Databases for a Purpose Challenge 1 Make a birthday database so you can see when and what to give your friends for special celebrations! Create a database with fields for: ° Name * Date of birth * Girl/ boy * special interests * What other fields might be useful? Remember to be consistent when you input the data. => What type of restaurant would you like to visit? Create a database of local restaurants which serve meals from different cultures. You might want to record how far they are from your home and if they deliver food or provide a take-away service. Mm Challenge 3S What local entertainments are there in your area? Are there cinemas, museums, sports facilities or clubs you can join? * Make a database that supplies useful information and contact details for each one. * Sortthe records to see which facies are closet to your home or which are the most expensive to use. 52 Databases for a Purpose

You might also like