Presentation is loading. Please wait.

Presentation is loading. Please wait.

Databases Lesson 2.

Similar presentations


Presentation on theme: "Databases Lesson 2."— Presentation transcript:

1 Databases Lesson 2

2 Learning Outcomes LO1: Be able to apply previous learning about key database key features/terms to an exam style question. LO2: Be able to define different types of file organization. LO3: Apply knowledge of serial, sequential and indexed sequential files to exam based questions.

3 Starter Exam Board Mark Scheme: -Swap questions with the person next to you and answer their question. -Give it back to your partner to mark. Pupils mark answers and then answer each others questions

4 CRUD A Database is handled by Software. Database software has to be able to: CREATE RETRIEVE UPDATE DELETE Similar in Python you could do all of these things. You could for instance create an address book in python where you can store data about a person (create it), then call upon it (retrieve it) you can change the program in python to add new data to the file or write different data (update) and you can also delete data that is no longer required (delete).

5 How the data is stored The purpose of the database affects the way that data is stored, organized and retrieved. There are different types of file organization you need to know about: Serial Files Sequential Files Indexed sequential Files

6 Serial File Simplest type of file structure. With a serial file structure, the records are stored one after the other without any logical order. When new records need to be added to the file they are appended to the end of the file. input search item go to first item in file repeat if item = search item then output item: Else move to next item until item found or no more data endif output item not found Write the pseudo code for finding information in a serial file A shopping list is an no computerized example serial file. (A collection of records, no particular order) In a very large database it would even take a computer a large amount of time to search through every piece of data until you find the one you want. Pupils write pseudo code Link to previous slide and python All you have to do is start at the first data item if its not the correct one move onto the next piece of data and so on….. A Loop can be written to do this expressed as an algorithm:

7 Sequential File If the data in a serial file is in some sort of order, perhaps based on an account number, the file is sequential (key fields)- the data is in some sequence.

8 A collection of records Stored in key sequence
Adding/deleting record requires making new file (so that the sequence is maintained) Used as master files Ways of searching a sequential file: -Binary Search -Use an Index Pupils makes notes Well known algorithms that’s can find items in an ordered file such as: Binary search= binary search works by looking at the middle record and deciding whether the wanted item is before or after it, then repeating the process . At each step the amount of data is halved. Using an index= another way of searching a sequential file is to use an index. Like an index in a book. The software looks up the position of the item in the index, goes straight to the part of the file where the required data is, then does a serial search there.

9 Indexed sequential file
A sequential file that is accessed using an index, which is a separate file. 1000 Copy diagram to help explain notes. Yellow pages is an example of a paper base indexed sequential file. How is it ordered so that you can get the information you want quickly? Alphabet index If it was just a list of services in the order they where added to the yellow pages when it was made would it be easy to find what you wanted? 2000

10 Serial and Sequential Files
Knowing what a serial and sequential files are can you thinking of advantages and disadvantages of each? Advantages Disadvantages Pupils write a list of advantages and disadvantages from what they know? Serial: Advantages: easier for small sets of data Disadvantages: Cannot be used as master, Used as temporary transaction file,Records stored in the order received Sequential: Advantages: faster, good for large amounts of data Disadvantages:

11 Swap questions and answer each other questions.
Plenary: Create your own exam questions and mark schemes for what you have learnt today. Swap questions and answer each other questions. Pupils create questions

12 Homework How does Google work? Is it sequential, indexed or serial?
What would happen if Google stored their data for search engines using one of the other types?


Download ppt "Databases Lesson 2."

Similar presentations


Ads by Google