240 likes | 488 Views
Databases. Storing and Organising Data. Log into your computers. Open up the DiDA website and read over the Database task, paying particular attention to the mark alerts. 5 Minutes. Key Questions. What is a database and what are the basic parts of a database?
E N D
Databases Storing and Organising Data • Log into your computers. • Open up the DiDA website and read over the Database task, paying particular attention to the mark alerts. 5 Minutes
Key Questions • What is a database and what are the basic parts of a database? • What do the words: field, record, database and validation mean? • How do I plan and create a new database? • How do I check the data entered into a database?
Databases • A database is just a large collection of organised information. • Many paper-based databases exist, such as: • These will probably be used by the people in your lists from the start of the lesson!
Parts of a Database • Fields (one piece of information) • Records (several pieces of information on one topic/item)
Question 1 • How many records are shown in the database below?
Question 2 • How many records are shown in the database below?
Question 3 • How many different fields does the database shown below have?
Question 4 • How many records are shown in the database below?
Question 5 • How many different fields does the database shown below have?
Task 1: Car Database • Go to: • Shared > ICT > Year 10 DiDA > Unit 1 > Nov-Dec > Lesson 1 • Copy and paste the ‘Car DB’ folder to your own ICT folder inside “My Documents”. • Work through ‘Car DB Tasks’ word document, using the Access database called ‘Car DB’. 20 Minutes
Data Types • Every field has what is known as a data type. This lets us know what sort of information will be placed into that field. Some data types are: Memo Text Number Currency Date/Time
Data Types - Example • What are the data types for the following examples: • “Green” • “12/03/1992” • “£4.50” • “01707 5421233” • “LS24 8AD” • “399” Text Date/Time Currency Text Text Number
Primary Key • A primary key is the name given to a special field which is the most important field in a database. This field is unique and therefore is different for each record in the database. • Eg a bank card number • Can you think of any other primary key examples?
Task 2: Planning A Database • As part of your Dance O’Clock coursework you will have to plan a database using a data dictionary. • Using the data saved in the shared area (click here) to help you, create a data dictionary (click here) to show how you will make a database to hold this information. Choose a sensible primary key and highlight it in bold in your data dictionary. • Finished? Compare with the person next to you then create in Access.
Validation • Validation checks that the data you enter is in the right form-ie it is valid data to enter and as expected. • Eg Check that numbers are not entered into a box that is reserved for text eg “First Name” • There are several ways of validating fields...
What to Validate? • The data type (eg Text/Numbers/Dates etc) • The field size (eg 16 characters) • The data that has been entered itself (eg for a Gender field, “M” or “F”) • The format of the data entered (eg capital letters, combinations of letters numbers or symbols etc). • There are 2 main methods to achieve the above – input masks and validation rules.
Method 1: Input Masks • An input mask can be used to change the text that is entered or to prevent certain text from being entered. • It should be added before adding data into the database. We use particular codes to specify what the input mask should do:
Input Mask Codes 0 A digit 0-9 must be entered # A digit 0-9 is optional L A letter between a-z must be entered ? A letter between a-z is optional A A letter or a digit must be entered a A letter or a digit is optional & Any character (or symbol )can be entered • We can combine certain input mask codes as well, eg: “L????” or “0&00” or “Aaaa&&&”.
Method 2: Validation Rules • Validation rules should be used to specify field sizes and in the case of predictable text input, to check what has been entered and then provide an error message in the case of any errors. • Eg to specify “only 14 characters long” (<=14) • Eg to specify “only accept M or F and if anything else is entered, give an error message” (M or F) • Click here for an example.
Task 3: Validate • Now add input masks or validation rules to your database. Check them carefully. • Now import the data file to the database (use this help sheet if unsure) and check that the data has been imported correctly. • Finished? Add at least 5 records of your own choice to the database.
Homework • Ensure you have completed the data dictionary for the Dance O’Clock database (click here). Indicate the primary key and also explain any input masks or validation rules to use.
Plenary • Click here and attempt the quiz for our lesson today.
IMPORTANT! • Log off the computer • Tidy up your computer area • Smarten up your uniform