Presentation is loading. Please wait.

Presentation is loading. Please wait.

Databases 101 © Dolinski 2007. What you will learn How relational databases work What are the components that make up a database How to create each component.

Similar presentations


Presentation on theme: "Databases 101 © Dolinski 2007. What you will learn How relational databases work What are the components that make up a database How to create each component."— Presentation transcript:

1 Databases 101 © Dolinski 2007

2 What you will learn How relational databases work What are the components that make up a database How to create each component

3 Relational Databases Unlike a flat file database –Database with a single flat file table Address Book Phone numbers Online Recipe Uses lots of tables which store subject specific information. This information is then linked to each other which creates the relationships.

4 Relational Databases DVD Rental Shop Flat file databases tend to store lots of repeated data. This means the databases becomes very inefficient. Flat files are also very restrictive. Updating a DVD’s price means changing every single record. This can lead to mistakes. NameAgeDVDPriceRating David15Matrix£3.99PG David15Mission Impossible 3£3.9915 Laura14Mean Girls£2.99PG David15Mean Girls£2.99PG

5 Relational Databases The solution to our problem is simple. Break down the tables into subject specific categories. In our rental shop example we would end up with three tables: –Customer –DVD –Rental

6 Relational Databases Customer Table: –Would store all the information we need to know about the customer. –This means we only need to store the customer’s details once. –This means that if a customer’s details change, for example, their address, then we only need to change one record.

7 Relational Databases DVD Table: –This would store information about the DVD’s in our shop. –Again, we only need to store the information once. –This means that we only have to change the details of a DVD once if they might change, for example, its rental price.

8 Relational Databases Rental Table: –Would store all the information about each rental. –The rental table would store the membership code of the customer, the DVD code and a rental code. –From the membership code in the rental table, we can find the customer’s details in the customer table, and likewise for the DVD details, we can find the details in the DVD table by using the DVD code.

9 Relational Databases In MS Access, we could see how our tables were linked by using the Relationships View:

10 Relational Databases Databases have different components that you can use. –Tables –Queries –Forms –Reports

11 Relational Databases Tables –Used for storing data Queries –Used for finding data Forms –Used for entering data Reports –Used for displaying data

12 Tables These are the first things you set up. In MS Access, you can use the design view to set up tables quickly and easily. You must decide on two main things: –Field Name –Data Type

13 Tables Field Names are used to identify the actual piece of data which needs to be entered. –Name –Address –Phone Number –Etc They are basically headings for the table.

14 Tables Data Types let us know what type of data each field will store. There are lots and it is important to chose the right one.

15 Tables Below is a list of data types that you might use: Data TypeWhat is it used for? TextStoring text and numbers which are not used in calculations, e.g. telephone and house numbers. NumberUsed for storing numbers such as quantities and ages. Date/TimeUsed for storing dates and times, e.g. Date of Births and booking dates. Yes/NoUsed for storing yes or no data, e.g. Has the Customer Paid? CurrencyUsed for storing money values, e.g. Prices AutoNumberUsed for storing unique values, e.g. membership numbers.

16 Tables Here is an example of a table in the design View:

17 Tables Data validation is another important aspect of table design. Data validation is the method of preventing bad data from entering the system. For your project you will only need to show two or three examples of your system using data validation.

18 Tables Data validation can be used on things such as: –Dates Not allowing underage people from buying certain products –Numbers Not allowing a number to be entered below or above a certain level e.g. Number of beds in a room

19 Tables Validation rules are entered in the validation rule field in the table design. Rules can be simple things such as: –>20  This rule means a number must be greater than 20 when entered. –Like “Mr” Or “Miss” Or “Mrs”  This rule means that only defined entries can be made into the system.

20 Tables This is an example validation rule for a customer table. –It defines the entries that are needed for the Title Field. –The validation text appears when data has been entered incorrectly or doesn’t meet the validation rule.

21 Queries These are used to find information. They can search through tables for data that we ask it to find, for example: –A name –Records between certain dates –Telephone numbers

22 Queries When writing a query we need to know two things: –What data fields we want to display –What data we want to look for

23 Queries This is the design view for a query: This query will ask the user to enter a valid customer number.

24 Queries The database will display a user input box and the user can type in the customer number: The results of the query will be shown.

25 Queries The code to do this is: In the Criteria field write this: –[Enter Customer number:] [This means open ended…the user defines]

26 Queries If I always wanted to find customer 0001 then in the criteria field I would enter 0001! AMAZING!!!

27 Forms Forms are used for data entry. They should be designed to allow data to be entered quickly and accurately. You can use a design wizard to help you set up your form but you will need to change the design to make it more user friendly.

28 Forms The wizard will produce something like this: This isn’t very user friendly and will probably result in some bad data from being entered.

29 Forms Changing the design can vastly improve: –The speed at which data is entered. –The accuracy of the data being entered. Using drop down boxes and option menus are a great way of speeding up data entry and they provide some data validation.

30 Forms Or you can use Option Buttons for example. You can use Drop Down Menus

31 Reports Reports are used to output data from the database. –Such as printing off a list of customers for example. Like the forms, you can use the design wizard to get the initial layout. You will need to tweak the layout to maximise the efficiency of the report. The wizard does a good job of wasting space!

32 Reports An example report produced by the wizard might look like this: The report can be designed to output data in any particular order. This report prints data out in ascending order of last name.


Download ppt "Databases 101 © Dolinski 2007. What you will learn How relational databases work What are the components that make up a database How to create each component."

Similar presentations


Ads by Google