Information Technology Outcome 2[1]: Database Application [INTERMEDIATE 1] Windows XP Version Part 1: Part 2: Part 3: Part 4: Part 5: About this section Understanding databases Searching and sorting a database Editing a database SAQ answers © Learning and Teaching Scotland 2004 This publication may be reproduced in whole or in part for educational purposes by educational establishments in Scotland provided that no profit accrues at any stage. Microsoft and Windows are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. All terms mentioned that are known to be trademarks have been capitalised. Screenshots reprinted by permission from Microsoft Corporation ABOUT THIS SECTION PART 1 Understanding databases What is this section about? This section will help you learn how to use a database. A database is one of 3 applications that you will learn to use in this unit. What will I learn? At the end of this section, you will be able to: understand what a database is and how it is made up launch an Access database edit and format data in an Access databases save and print out data in an appropriate format close down Access. How long should it take to do this? You should complete this section in about 6–8 hours. What else do I need? You will need access to a computer with Microsoft Access installed. You will need files from the disk ‘IT Core Skills - Intermediate1’. You may have already copied these into your own folder on the hard disk. How will I be assessed on my work in this section? You will be assessed through a practical assignment. This assignment is likely to be linked to one of your interests or to your studies in other subjects. Your tutor will give you this assignment when you are ready for it. Your tutor will want to supervise you doing this assignment so that he or she knows that it is your own work. The assignment will test your ability to do the above tasks well. You will get an opportunity for re-assessment if you need it. INFORMATION TECHNOLOGY (INT 1)/WINDOWS XP VERSION: OUTCOME 2[1] 1 © Learning and Teaching Scotland 2004 UNDERSTANDING DATABASES PART 2 What is a database? Here are some examples of databases in common use: Address books CD catalogue Yellow Pages A list of activities at a swimming pool or club TV listings in newspapers. These are all databases on paper. A database is a collection of data that is: related in some way, e.g. all today’s TV programmes structured in some way, e.g. laid out in a table on the page. Questions 1 What might be the relation and structure in a CD catalogue? What is the relation and structure in Yellow Pages? INFORMATION TECHNOLOGY (INT 1)/WINDOWS XP VERSION: OUTCOME 2[1] 2 © Learning and Teaching Scotland 2004 UNDERSTANDING DATABASES Understanding how data is stored Databases can also be stored electronically in a computer s ystem. The data in an electronic database like Access must also be related and structured. There are two parts to an electronic database: 1. The database application created by a software company. This software is either bought in a shop or sold as part of an IT system. 2. The datafile, e.g. a club membership list. The data in a datafile is entered by you. The database application arranges your data into a table. A table consists of rows and columns. column Country HepA/Polio/Typhoid Greece row Meningitis Diphtheria Y Russia Tajikistan Y Y Y Ukraine Y This is part of a table that you will use later. It contains health advice to travellers to certain countries. For example, travellers to Tajikistan should be immunised against Hepatitis A, Polio, Typhoid and Diphtheria. Questions 2 What should travellers to Russia be immunised against? INFORMATION TECHNOLOGY (INT 1)/WINDOWS XP VERSION: OUTCOME 2[1] 3 © Learning and Teaching Scotland 2004 UNDERSTANDING DATABASES You may be more used to seeing data in this form: Records Fields Country: Greece HepA/Polio/Typhoid: Yes Meningitis: No Diphtheria: Yes Data All the data about one item is held together in a record. Each record has a number of fields to keep data. The above record has four fields. Each record in a database looks exactly the same but has different data in the fields. Compare the table on the previous page with the record layout above. How is the data from a single record laid out in a table? There is an online animation available entitled ‘Understanding how data is stored’. INFORMATION TECHNOLOGY (INT 1)/WINDOWS XP VERSION: OUTCOME 2[1] 4 © Learning and Teaching Scotland 2004 UNDERSTANDING DATABASES Databases quiz Now try the following questions to test your understanding of the terms used with databases. 1. What is a database? ____________________________________________________ 2. Name the two parts to an electronic database. ____________________________________________________ 3. Use the following words to complete the sentence below: data A record database contains all the Each piece of data is held in a field about 1 item in a . . This quiz is available online. INFORMATION TECHNOLOGY (INT 1)/WINDOWS XP VERSION: OUTCOME 2[1] 5 © Learning and Teaching Scotland 2004 SEARCHING AND SORTING A DATABASE PART 3 Opening a Database You are going to load a file from the disk ‘IT Core Skills – Intermediate 1’ for this part. You may have already copied this file into your folder on the hard disk. You already know how to load a file but here is a reminder. To load the file from the floppy disk: Insert the floppy disk correctly into the A: drive. Double click on the icon My Computer. Double click on the icon 3½ Floppy(A:). Double click on the icon for Health Advice for Travelling. To load the file from your own folder: Double click on the icon for My Documents. Scroll down the alphabetical list of folders to reach your own. Double click on your own folder. Double click on the icon for Health Advice for Travelling. The computer recognises that the file Health advice for Travellers is an Access data file. It launches Access and then loads the data file into the Access structure.This is what you should see on the screen. Screenshot reprinted by permission from Microsoft Corporation There is an online animation available entitled ‘Opening a database. INFORMATION TECHNOLOGY (INT 1)/WINDOWS XP VERSION: OUTCOME 2[1] 6 © Learning and Teaching Scotland 2004 SEARCHING AND SORTING A DATABASE The large window is the Access window. The small window asks whether you want to create a table or use an existing one. You will use the only one that exists. It is already highlighted. Double click on Health Advice for Travellers to see this screen. Screenshot reprinted by permission from Microsoft Corporation There are 17 records in this table. Each one holds data about a different country. There are four fields in this table: 1. Country 2. HepA/Polio/Typhoid 3. Meningitis 4. Diphtheria. The fields hold data such as ‘Canada’ or ‘Burma’ or ‘Y’. There is an online animation available entitled ‘Introduction to tables’. INFORMATION TECHNOLOGY (INT 1)/WINDOWS XP VERSION: OUTCOME 2[1] 7 © Learning and Teaching Scotland 2004 SEARCHING AND SORTING A DATABASE This is only a very small table of data. Imagine how big it would be if it covered every country in the world. You would have to search many pages to answer questions such as: What precautions should I take if I travel to Finland? Where can I travel without being immunised against diphtheria? Do meningitis and diphtheria ever happen in the same country? You would have to search and sort through the data for a long time and you might make mistakes. An electronic database can do the searching and sorting for you and will not make mistakes. There is an online animation available entitled ‘Introduction to searching and sorting’. The mouse pointer Move the mouse pointer gently around the screen. Notice that it changes shape at different points. For example, you will see that inside the table the mouse pointer changes to an I -point like this You will learn more about these pointer shapes as you progress. There is an online animation available entitled ‘Mouse pointers’. INFORMATION TECHNOLOGY (INT 1)/WINDOWS XP VERSION: OUTCOME 2[1] 8 © Learning and Teaching Scotland 2004 SEARCHING AND SORTING A DATABASE Searching a table Access uses the phrase ‘filter by selection’ to mean ‘search for certain data’. Let’s search for those countries where there is a risk of catching diphtheria. Click on any cell in the Diphtheria column where there is a ‘Y’. An arrowhead appears in the far left column. This arrowhead marks the row where you are working. Move the pointer to the tool bar at the top of the screen and click on the Filter by Selection icon. The table now shows only those countries where diphtheria is a risk. The bar at the bottom of the Access window tells you that a filter is on. Click on the Filter icon in the tool bar to see the full table of data again. This same icon can switch a filter on or off. Try it now. Remember to finish by switching the filter off. Activity Search for those countries where there is a risk of Meningitis. Remember to switch off the filter afterwards. There is an online animation available entitled ‘Searching a table’. INFORMATION TECHNOLOGY (INT 1)/WINDOWS XP VERSION: OUTCOME 2[1] 9 © Learning and Teaching Scotland 2004 SEARCHING AND SORTING A DATABASE Sorting a table The table is currently sorted by country in descending alphabetical order. Let’s sort it by country into ascending order. Move the pointer to the centre of the column heading Country. When it changes to , click the mouse button. The Country column will be highlighted. Click on this icon in the tool bar. The table now looks like this: Click on this icon to return the table to descending order. INFORMATION TECHNOLOGY (INT 1)/WINDOWS XP VERSION: OUTCOME 2[1] 10 © Learning and Teaching Scotland 2004 SEARCHING AND SORTING A DATABASE The sort icons also work for numbers. For example: sorting a column of costs in descending order will place the dearest item at the top of the column; sorting running times in ascending order will find the fastest on the track at the top of the column. Close all windows on the desktop. The system will ask ‘Do you want to save changes …. ?’. It is important that the table does not change before the next activities. You do not want to save the changes. Click No. There is an online animation available entitled ‘Sorting a table’. INFORMATION TECHNOLOGY (INT 1)/WINDOWS XP VERSION: OUTCOME 2[1] 11 © Learning and Teaching Scotland 2004 SEARCHING AND SORTING A DATABASE Databases activity There is another data file Mobile Phones in your folder or on the floppy disk ‘IT Core Skills – Intermediate 1’. You are going to use that file to find answers to the following questions. Look back in these notes to find how to do any task that you have forgotten. 1. Load the data file Mobile Phones into Access. How many records does the table contain? How many fields does each record have? 2. Searching Display the list of phones that have the feature Advanced games. Display and print the list of phones for £79.99? 3. Sorting Display a list of phones sorted by cost. Which is the dearest phone in stock? Display and print a list of phones sorted by number in stock. Which phone is out of stock? Close all windows on the desktop. Again, the system will ask ‘Do you want to save changes …. ?’. As before, it is important that the table does not change before the next activities. Click No. Check your answers to this activity in the Part 5: SAQ answers at the end of this section. These questions are available in an interactive format entitled ‘Databases activity’. INFORMATION TECHNOLOGY (INT 1)/WINDOWS XP VERSION: OUTCOME 2[1] 12 © Learning and Teaching Scotland 2004 EDITING A TABLE PART 4 Editing a table Tables need to be edited as data changes. You need to know some important keys on a keyboard before editing a table. Back space key Space bar Shift key Return key Back space key You use this key to delete mistakes. Pressing it once deletes the last letter entered. Shift key You use this key to get a capital letter. Hold the shift key down while you press the letter that you want to make a capital. You use it in the same way to get the symbol at the top of any key with two functions. Space bar You use this to create a space between words. Return key (or Enter) You use this key to take a new line in a piece of text or to confirm a decision. There is an online animation available entitled ‘Editing a table’. INFORMATION TECHNOLOGY (INT 1)/WINDOWS XP VERSION: OUTCOME 2[1] 13 © Learning and Teaching Scotland 2004 EDITING A TABLE Adding a new record Load the table Health Advice for Travelling. There is always a blank row at the bottom of any table. This is where you can enter new records. Here is new information for this table. Travellers to Iran should be immunised against HepA/Polio/Typhoid. You are going to add a new record for Iran. Move the pointer to the empty cell at the bottom of the first column and click the mouse button. The text cursor is now flashing in that cell, waiting for you to enter text from the keyboard. Enter Iran. In the same way, move the pointer to each cell along the row to complete Iran’s record. Add a new record for Rwanda. Travellers to Rwanda should be immunised against HepA/Polio/Typhoid and Meningitis. There is an online animation available entitled ‘Adding a new record’. INFORMATION TECHNOLOGY (INT 1)/WINDOWS XP VERSION: OUTCOME 2[1] 14 © Learning and Teaching Scotland 2004 EDITING A TABLE Deleting a record Advice to travellers to Tajikistan is being reviewed. Let’s delete Tajikistan’s record for now. Move the pointer to the grey box on the left of Tajikist an and click the mouse button. The whole Tajikistan row should be highlighted. Move the pointer into the tool bar and click on this icon. A window opens on the screen. Click Yes to confirm you want to delete the record. Delete Canada’s record in the same way. There is an online animation available entitled ‘Deleting a record’. Adding field data The data inside fields also needs to be changed at times. To add data, simply place the pointer inside the correct cell and click. When the text cursor flashes, enter the new data. Add the following data to India’s record: Travellers to India should now be immunised against Meningitis. There is an online animation available entitled ‘Adding field data’. INFORMATION TECHNOLOGY (INT 1)/WINDOWS XP VERSION: OUTCOME 2[1] 15 © Learning and Teaching Scotland 2004 EDITING A TABLE Deleting field data The entry for diphtheria in Greece is a mistake and should be deleted. Move the pointer to the left of the diphtheria field in the record for Greece. Move it slowly into the field and it will change to an open cross. When the pointer is this shape, click the mouse button to highlight the data in this cell. Press the Back space key. Note that the ‘Y’ has been deleted. There is an online animation available entitled ‘Deleting field data’. Amending field data Burma is now called Myanmar. To make this change: move the pointer slowly into the left of Burma in the country field. when the open cross appears, click the mouse button to highlight the text. enter Myanmar at the keyboard. The table is no longer sorted alphabetically by country. Re-do this sort. There is an online animation available entitled ‘Amending field data’. INFORMATION TECHNOLOGY (INT 1)/WINDOWS XP VERSION: OUTCOME 2[1] 16 © Learning and Teaching Scotland 2004 EDITING A TABLE Formatting a table You should always check to see if you can improve how your table looks. This is called formatting the table. Notice that Switzerland has not enough room. Part of it is cut off. Move the pointer slowly over the heading of the Country field towards the next heading. When the pointer changes to a solid black cross, click and drag the mouse slowly to the right. This will widen the column. There is an online animation available entitled ‘Formatting a table’. Saving a table It is important to save your work often, particularly if you have made a number of changes. Click on File in the menu bar. Select Save from the menu. Your stored file will now be updated. Printing a table Select File from the top menu bar. Select Print from the menu which opens. Press OK when the Print menu appears. Close all windows on the desktop. INFORMATION TECHNOLOGY (INT 1)/WINDOWS XP VERSION: OUTCOME 2[1] 17 © Learning and Teaching Scotland 2004 EDITING A TABLE Tables activity Complete the following tasks on the data file Mobile Phones. 1. Add the following record: Moneric Y5, £159.99, Special Feature is ‘Advanced games’, 3 in stock. 2. The Moneric X3 will no longer be available. Delete the Moneric X3 record. 3. A new delivery of 4 Sunblush has arrived. Amend the record to show the new stock number. 4. The Sunblush has now to be called Sunblush Gaming. Amend the name. 5. Format the document so that all columns are wide enough. 6. Save the amended file. 7. Print the amended table. 8. Close all windows. Before you finish this section, make sure that you know how to: Search a table Sort a table Enter and delete records in a table Enter and delete data in the cells of a table Format a table Save a table Print a table. Look back to remind yourself if you have forgotten how to do any of these tasks. INFORMATION TECHNOLOGY (INT 1)/WINDOWS XP VERSION: OUTCOME 2[1] 18 © Learning and Teaching Scotland 2004 SAQ ANSWERS PART 5 Answers 1 CD catalogue Connection: all the CDs in stock. Structure: alphabetically in order of style of song and then singer. Yellow Pages Connection: local businesses which have paid to be listed in Yellow Pages. Structure: alphabetically in order of business and then name. Answers 2 Travellers to Russia should be immunised against Diphtheria. Databases quiz - Answers 1. A database is a collection of related and structured data. 2. The application software and the table of data. (datafile) 3. A record contains all the data about one item in a database. Each piece of data is held in a field. INFORMATION TECHNOLOGY (INT 1)/WINDOWS XP VERSION: OUTCOME 2[1] 19 © Learning and Teaching Scotland 2004 SAQ ANSWERS Databases activity - Answers 1. Number of records = 10 Number of fields = 4 2. Advanced gaming phones are Megas 6 and Sunblush. Choice of phones for £79.99 is Megas 6, Pinnochio 4S or Samran B4. 3. The dearest phone in stock is £219.99. The Moneric X3 is out of stock. Tables activity - Answers Name Cost Special Feature in Stock Connect-2-You £29.95 Changeable cover 20 Pinocchio 5C £29.95 Voice-activated dialing 4 Megas 6 £79.99 Advanced games 3 Moneric Y5 159.99 Moneric Y5 £159.99 Advanced games 3 Pinocchio 4S £79.99 Tri-band technology 3 Sunblush Gaming £169.99 Advanced games 6 See-you-Too £219.99 Built in camera 8 Samran B3 £69.99 Infrared connection 10 Samran B4 £79.99 Voice-activated dialing 12 Megas 5 £29.95 Speaker phone 1 Moneric Y5 £159.99 Advanced games 3 0 INFORMATION TECHNOLOGY (INT 1)/WINDOWS XP VERSION: OUTCOME 2[1] 20 © Learning and Teaching Scotland 2004