Chapter 17 Creating a Database 1 What’s Inside and on the CD? • In this chapter, you will be introduced to Microsoft Access and its powerful tools for: – – – – – Entering and updating information Deleting information Sorting data Searching for specific data Creating reports Practical Computer Literacy, 2nd edition Chapter 17 2 How is data organized in a database? • Database software like Microsoft Access can be complex but is useful for organizing many types of data • An Access database consists of tables • Each table is similar to a stack of index cards Practical Computer Literacy, 2nd edition Chapter 17 3 How is data organized in a database? • Each card in the stack contains similar information, which relates to a single entity. • A database record is equivalent to one index card. Practical Computer Literacy, 2nd edition Chapter 17 4 How is data organized in a database? Practical Computer Literacy, 2nd edition Chapter 17 5 How is data organized in a database? • Data can be displayed in different ways • The table view is a grid of rows and columns • Each row contains one record, equivalent to one index card Practical Computer Literacy, 2nd edition Chapter 17 6 How is data organized in a database? • Each cell in a row contains the data for one field • The table is composed of all fields in all rows, equivalent to the entire stack of index cards Practical Computer Literacy, 2nd edition Chapter 17 7 How is data organized in a database? Practical Computer Literacy, 2nd edition Chapter 17 8 What’s in the Access window? • To start Access: – – – – Click Start Click All Programs Click Microsoft Office Click Microsoft Office Access 2007 • Getting Started with Microsoft Office Access window appears – use it to: – – – – Connect to Microsoft Office Online Search for an existing file Create a new database Open an existing database Practical Computer Literacy, 2nd edition Chapter 17 9 What’s in the Access window? • With Access, you typically don’t create a new database but open an existing one to add to or edit data it contains • Unlike other Microsoft programs, Access databases are not displayed as they will be printed • Access provides several tools used to create, modify, and display data Practical Computer Literacy, 2nd edition Chapter 17 10 What’s in the Access window? • Tools, used to create tables and simple queries, are contained in the Navigation Pane on left side of the database window • Access offers many different ways to use each tool • Access is a complex software • In order to simplify introduction, some basic ways to use most common tools will be introduced Practical Computer Literacy, 2nd edition Chapter 17 11 What’s in the Access window? Practical Computer Literacy, 2nd edition Chapter 17 12 How do I create a new database or open an existing database? • Creating a database is different from a document, worksheet, or presentation • In Access you first save an empty database then create elements of database • Elements include: – Tables – Reports – Forms – Queries Practical Computer Literacy, 2nd edition Chapter 17 13 How do I create a new database or open an existing database? • Database needs to be saved only once • As you add or change data, changes are automatically saved • When finished, just close it Practical Computer Literacy, 2nd edition Chapter 17 14 How do I create a new database or open an existing database? • If database is already created, select name from Getting Started with Microsoft Office Access window • To open database: – Use More files link on Getting Started with Microsoft Office Access window – Select storage device – Select file name – Click Open Practical Computer Literacy, 2nd edition Chapter 17 15 How do I create a new database or open an existing database? Practical Computer Literacy, 2nd edition Chapter 17 16 How do I create a table using a Table Template? • You must specify the structure of tables, records, and fields before you can enter data • Table Templates make it easy to create tables for common business and personal databases. • A table contains records – Each record contains one or more fields • Each field contains a type of data such as name or data Practical Computer Literacy, 2nd edition Chapter 17 17 How do I create a table using a Table Template? • After you create the database, make sure that Table is selected in the Objects list • Double-click Create table by using wizard • Select the most appropriate table type Practical Computer Literacy, 2nd edition Chapter 17 18 How do I create a table using a Table Template? • Have Access create a primary key, which is a field that uniquely identifies each record • Save the table • Give the table a unique name – Not necessarily the same name for the database Practical Computer Literacy, 2nd edition Chapter 17 19 How do I create a table using a Table Template? • If you are saving to a floppy disk or USB flash drive, do not remove it until the Access window closes • To open the database the next time you start Access, click the file name from the Getting Started with Microsoft Office Access window Practical Computer Literacy, 2nd edition Chapter 17 20 How do I create a table using a Table Template? Practical Computer Literacy, 2nd edition Chapter 17 21 How do I create a table using a Table Template? Practical Computer Literacy, 2nd edition Chapter 17 22 How do I create a table using a Table Template? Practical Computer Literacy, 2nd edition Chapter 17 23 How do I enter and edit data in a table? • Once fields are defined for table, data for each entity becomes one record, or row, in table • If table is not open, double-click the name of the table in the Navigation Pane • An empty record is always displayed at bottom of table Practical Computer Literacy, 2nd edition Chapter 17 24 How do I enter and edit data in a table? • Each time record added, a new empty row appears • Make sure data is consistent - for example, don't use MI and Michigan in same database • To edit data, click cell containing data Practical Computer Literacy, 2nd edition Chapter 17 25 How do I enter and edit data in a table? • Use left and right arrow keys to move insertion point within field • Use Backspace and Delete to delete text to left or right of insertion point • To delete entire record: – Right-click row header – Click Delete Record on shortcut menu – Click Yes button Practical Computer Literacy, 2nd edition Chapter 17 26 How do I enter and edit data in a table? Practical Computer Literacy, 2nd edition Chapter 17 27 Can I import data into a database? • You can import data from files created with other software – Worksheets created with Excel – Databases created with older versions of Access – E-mail address books created with Outlook – Comma-delimited files • A comma-delimited file, sometimes referred to as a CSV file, is data separated by commas Practical Computer Literacy, 2nd edition Chapter 17 28 Can I import data into a database? • Many software applications offer an export option that creates a comma-delimited file • Import a CSV file by selecting the Import text file from the External Data tab and then select the file Practical Computer Literacy, 2nd edition Chapter 17 29 Can I import data into a database? Practical Computer Literacy, 2nd edition Chapter 17 30 How do I create a table in Design View? • If Table Templates don’t meet your needs for a table design, you may create your own in Design View • When you create your own table, you must specify a data type for each field • A data type determines what kind of data can be entered into the field Practical Computer Literacy, 2nd edition Chapter 17 31 How do I create a table in Design View? • Use Text data type for fields that will contain data up to 255 characters in length • Use Memo data type for fields that will contain variable length data, such as comments, notes, and reviews Practical Computer Literacy, 2nd edition Chapter 17 32 How do I create a table in Design View? • Use Number data type for fields that will contain numeric data – Don't use Number data type for data that looks like a number but will never be calculated – A telephone number field should be defined as Text • Use Date/Time data type for dates and times Practical Computer Literacy, 2nd edition Chapter 17 33 How do I create a table in Design View? • If you have allowed Access to define the primary key – ID field is created using the AutoNumber data type – Unique number is automatically entered in field as record is entered Practical Computer Literacy, 2nd edition Chapter 17 34 How do I create a table in Design View? • Yes/No data can be useful for fields designed to hold simple Yes/No or True/False data – Example, use Yes/No data type for field “Subtitled?" • After all fields defined, save and close table to begin entering data in new table Practical Computer Literacy, 2nd edition Chapter 17 35 How do I create a table in Design View? Practical Computer Literacy, 2nd edition Chapter 17 36 How do I work with tables? • Working with data in Access can be similar to working with data in an Excel worksheet • You can add, delete, move, sort, and search for data • Controls for these operations are on the ribbon Practical Computer Literacy, 2nd edition Chapter 17 37 How do I work with tables? • Operations for working with tables include: – Modify data – Insert a record – Delete a record – Move a field – Hide a field – Sort records – Search Practical Computer Literacy, 2nd edition Chapter 17 38 How do I work with tables? Practical Computer Literacy, 2nd edition Chapter 17 39 How do I create a query using a wizard? • Data in a table can be manipulated in many ways, e.g.: – search a company database for products that cost more than $10 – create a query to search for records containing particular data • A query contains criteria that specifies what you want to find Practical Computer Literacy, 2nd edition Chapter 17 40 How do I create a query using a wizard? • Use query to display some, but not all, fields in table • The Query Wizard is a quick way to learn about simple queries and use them to locate data Practical Computer Literacy, 2nd edition Chapter 17 41 How do I create a query using a Wizard? • Simple Query Wizard – What fields do you want in your query? – click a field – click button to add an individual field to query – click button to add all fields to the query – click button to remove an individual field from query – click button to remove all fields from query Practical Computer Literacy, 2nd edition Chapter 17 42 How do I create a query using a Wizard? • Simple Query Wizard – Would you like a detail or summary query? – Detail option shows all specified fields for records – The Summary option displays how many records match your criteria • Simple Query Wizard – What title do you want for your query? – Enter a title and click the Finish button to see the results of your query Practical Computer Literacy, 2nd edition Chapter 17 43 How do I create a query using a Wizard? • To refine search, specify query criteria – Example, to see only records of items costing more then $10: • Close query window • Right-click query tab • Click Design View on shortcut menu • Type >10 in criteria row under Price field • Click Run button on Query Tools Design contextual tab Practical Computer Literacy, 2nd edition Chapter 17 44 How do I create a query using a Wizard? • When window closed after viewing results of query specified by query criteria: – Message asking - Do you want to save changes to design of query ‘Query Name’? – Click Yes if you want to use same criteria every time you use query • After query is saved, you can use it repeatedly on all data that matches criteria specified Practical Computer Literacy, 2nd edition Chapter 17 45 How do I create a query using a Wizard? Practical Computer Literacy, 2nd edition Chapter 17 46 How do I create a query using a Wizard? Practical Computer Literacy, 2nd edition Chapter 17 47