CIS 145 test 1 review


Published on


  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

CIS 145 test 1 review

  1. 1. Test 1 Review10/22/2012 1
  2. 2. Database  Collection of related data and tools to use, manage data  Relational database  Data stored in tables  Each table stores data about one thing  Common values create connections (relationships) between tables10/22/2012 2
  3. 3. Fields, Records, and Tables  Fields  Basic unit of data represented by a column in a table datasheet  Records  Group of related fields or all fields related to a specific item: person, place, or thing  Each row of a datasheet represent a record  Tables  Group of related records10/22/2012 3
  4. 4. Planning a Database  What information do you want to obtain?  What data elements (fields) must you include to be able to get the information?  What types of data will you enter into each field?  Dates, numeric values, amounts of money, text, etc.  What fields of data relate to the same basic items and belong grouped together?  How do the groups of data relate to each other?  What questions will you need the database to be able to answer?  What is the most efficient way to get data into the database tables?10/22/2012 4
  5. 5. Creating Tables  Each table should contain fields that focus on data specific to one type of item  Such as customers, employees, inventory, etc.  Each table should have a primary key  Fields in the primary key cannot be empty (null)  May be one or more fields  Each generic field# heading is replaced with a descriptive field name10/22/2012 5
  6. 6. Table Design Guidelines  Store all necessary data  Store data in smallest parts  Avoid calculations10/22/2012 6
  7. 7. Using Table Design View  Presents a blank work area on which to enter fields  Provides tools for setting data types, descriptions, and properties  Enables you to change the structure and organization of fields in the table10/22/2012 7
  8. 8. Entering Field Names  Field names:  Short but descriptive  Can contain alpha-numeric characters  Can contain many symbols  Can contain spaces  Must start with a character or symbol  May use naming convention  Identify table, data type, and field description10/22/2012 8
  9. 9. Identifying Data Types  Data types identify the kind of data to be added to a field  Text  Numbers  Dates/Times  Currency  Setting a data type controls values that the field contains10/22/2012 9
  10. 10. AutoNumber Fields  Fields that automatically number records as you add them to a table  Numbers can’t be entered or changed by user  If you delete a record from a table, or cancel a new row, Access never assigns the number to any new record10/22/2012 10
  11. 11. Field Properties  Field Size determines how much data can be stored  Some data type sizes are fixed – date/time, yes/no  Format controls how a value is displayed  Input Mask controls which keyboard entries will be required and accepted  Validation Rule sets limits on values that a field will accept  Validation Rule applies regardless of how data is entered or changed  Set Validation Text to explain how to correct an entry10/22/2012 11
  12. 12. Operators  Operators are used in validation, calculations and queries  Comparison Operators:  Relational Operators (=, >, <, <>, >=, <=)  Patterns (Like)  Compare to a list (In)  Logical operators define how to tie tests together  And, Or, Not10/22/2012 12
  13. 13. Using Wildcards  Used in patterns instead of specific characters  Primary wildcards used:  * Represents any number of characters  ? Represents an individual character  Examples:  *Graham* locates all records with graham within the text  Gra?am locates all records with gra at the beginning of the field value and am at the end of the field value with only one letter between10/22/2012 13
  14. 14. Relational Databases  Have more than one table where tables are related to each other  One to one  One to many  Many to many  A combination of fields may be used for the table’s primary key10/22/2012 14
  15. 15. One to Many Relationships Each table contains data about a specific subject (customers, loans) Each table on the ‘one’ side has a primary key Primary key of the “one” table is a foreign key in the many table
  16. 16. Many to Many Relationships Two tables are related, but can have many records in each table in common  One student can attend many courses; one course can be attended by many students Implement a many to many relationship by creating a pair of one to many relationships with a third table  Third table is often referred to as a “join” or “junction” table  Entries in the join table point to rows in the original tables
  17. 17. Foreign Key A foreign key points to a record in another table Foreign key “looks like” the related primary key  Same number of fields  Data types for each field must match  Field names don’t matter
  18. 18. Referential Integrity Makes sure that the records in related tables are consistent  Must have a customer in the customer table for an order assigned to that customer  Avoids “orphans” Cannot delete a record or change the primary key in the one table when associated records are in the many table, unless have cascade delete and cascade update enabled
  19. 19. Editing Data Making new entries, changing existing entries, and deleting rows are all affected by referential integrity  A customer can be added at any time  Must have a customer before a loan can be entered and associated with a customer  Referential integrity doesn’t require entry into a foreign key  Can delete a loan at any time, but can only delete a customer if they don’t have any loans (assuming no cascade delete)
  20. 20. Cascading Changes When referential integrity is enforced can choose to include Cascade Update and/or Cascade Delete  Cascade update passes changes to the primary key of the “one” table to the related rows in the “many” table  Cascade delete removes rows from the “many” table when a primary key (row) is deleted from the “one” table
  21. 21. Relationships Window Where relationships between tables are created and defined Related fields must have the same data type  Autonumber is related to number field with long integer field size The one table has a 1 next to it; the many has a next to it
  22. 22. Autolookup Queries Use queries to automatically look up data from related tables Must contain the foreign key from the many table Can add, change or delete data in the source tables