Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Open Database Connectivity wikipedia , lookup
Oracle Database wikipedia , lookup
Entity–attribute–value model wikipedia , lookup
Ingres (database) wikipedia , lookup
Extensible Storage Engine wikipedia , lookup
Microsoft Jet Database Engine wikipedia , lookup
Concurrency control wikipedia , lookup
Functional Database Model wikipedia , lookup
Relational model wikipedia , lookup
Clusterpoint wikipedia , lookup
DATABASES REVISION BOOKLET (and exam questions) NAME: ____________________________ CLASS: __________________ DATABASES DEFINITION: A database is a collection of data or information which is held together in an organised or logical way. There are a few terms that you need to understand when learning about databases. TABLES Databases store data or information in tables, just like the one below: The table allows you to see all of the records stored in the database. Tables can store many records, from a few dozen for a small database up to millions for a large company database. RECORDS Each table contains a lot of records. DEFINITION: A record is all of the data or information about one person or one thing. In the table below, all of the information about each cartoon character is stored in a 'row' or 'record'. FIELDS Each table contains a lot of records. A record is made up of lots of individual pieces of information. Look at Wonder Woman's record: it stores her first name, last name, address, city and age. Each of these individual pieces of information in a record is called a 'field'. DEFINITION: a 'field' is one piece of data or information about a person or thing. DATA TYPES Here is a database table with the different data types set up for you to see: PRIMARY KEY Imagine what would happen if Mrs Smith telephoned the school to ask the secretary to pass on a message to her daughter Charlotte. If there were nothing to uniquely identify the students' records, the secretary would have to search for all of the 'Charlotte Smiths' in school and then say, 'sorry to keep you waiting Mrs Smith, could you just tell me if your daughter is in year 7, 8, 10, 11 or 13? And if she is in year 7, which one of these five girls is she?' How about a patient going to have an operation. 'Oh hello Mr Jones, I have 4 Mr Joneses having an operation today, can you tell me if yours is to remove your tonsils, your arm, put your leg in a cast or give you a hair transplant?'. I think that would be one very worried patient! Therefore, it is important that every single record in a database has something to uniquely identify it and this is called the 'Primary Key' or sometimes the 'Key Field'. FLAT FILE DATABASE When you first set up your database, you can choose to make a 'flat-file' database or a With a flat file database, all of your data is stored in one large table. RELATIONAL DATABASE In the database below, the data is split up into sensible groups i.e. customer data, pets data and appointments data. Then a separate table is made for each group. Customer Table Pet Table Appointment Table Once the tables have been set up, a relationship can be created to link them together as shown by the lines linking the tables below. This is known as a 'relational database'. The main benefit of a relational database is that data doesn't have to be duplicated. When a customer books an appointment for their pet, a new record is created on the 'appointment's table' and the relevant Customer and Pet IDs are chosen. Reducing data duplication reduces the amount of data which needs to be stored, thus making the database smaller. It also reduces the risk of mistakes, because every time you have to type the same data in, there is a risk you could mis-spell it. Databases 1. Explain what the term ‘data’ means and give an example ……………………………………………………………………………………………………………… ……………………………………………………………………………………………………………… …………………… 2. Explain what the term ‘information’ means and give an example ……………………………………………………………………………………………………………… ……………………………………………………………………………………………………………… ……………………………………………………………………………………………………………… ................................. 3. Explain in your own words what a database is used for ……………………………………………………………………………………………………………… ……………………………………………………………………………………………………………… ……………………………………………………………………………………………………………… ................................. 4. Give an example of a paper-based database ……………………………………………………………………………………………………………… ………… 5. Give an example of a computerised database ……………………………………………………………………………………………………………… ………… 6. Explain what each of these terms mean in relation to a database and give an example: Field ……………………………………………………………………………………………………………… ……………………………………………………………………………………………………………... ..................... Record ……………………………………………………………………………………………………………… ……………………………………………………………………………………………………………... File ……………………………………………………………………………………………………………… ……………………………………………………………………………………………………………... 7. What is the purpose of a primary key? ……………………………………………………………………………………………………………… ……………………………………………………………………………………………………………… Which of the following database fields would be the most suitable to use as a primary key (tick and explain why)? Student Name Student Address Student Number Student D.O.B. Student’s Form Which of the following database fields would be the most suitable to use as a primary key (tick and explain why)? Car model Car make Colour Registration number Number of doors 8. Explain the difference between a ‘flat-file’ database and a ‘relational’ database ……………………………………………………………………………………………………………… ……………………………………………………………………………………………………………… ……………………………………………………………………………………………………………… 9. When setting up your fields in a database, you should choose the most appropriate datatypes. Explain what type of data would be stored in each of the following datatypes Alphanumeric (text) Text and text with numbers combined Number Numbers including those with decimal places Currency Date/Time Logical/ Boolean/ Yes No Autonumber Give an example for the following data types Alphanumeric (text) Number Postcode – CV64 3RT Currency Date/Time Logical/ Boolean/ Yes No Autonumber Which would be the most appropriate data type for the following? £15.99 NQTR56N8J 15, Pear Tree Avenue 14th November 2002 Male Female 16 10. Explain why it is important to change the field length from the default of 50 characters to something more appropriate ……………………………………………………………………………………………………………… ……………………………………………………………………………………………………………… ……………………………………………………………………………………………………………… Decide which would be appropriate field lengths for the following fields Gender (male/female) Forename House number and street name Postcode Telephone number 11. When setting up a database table, it is a good idea to use validation. Explain what the purpose of validation is for. ……………………………………………………………………………………………………………… ……………………………………………………………………………………………………………… ……………………………………………………………………………………………………………… Validation cannot stop incorrect information from being entered into the database. Explain why, giving an example ……………………………………………………………………………………………………………… ……………………………………………………………………………………………………………… ……………………………………………………………………………………………………………… There are different types of validation which you might choose to include. Fill in the table on the next page: Type of Explanation Example validation Required field This means that data must be entered into every field – the field cannot be left blank Type check Range check Presence check Picture or format check Telephone number 12. Explain what the term ‘Garbage in Garbage out’ (GIGO) means ……………………………………………………………………………………………………………… ……………………………………………………………………………………………………………… ……………………………………………………………………………………………………………… 13. Explain what the term ‘Verification’ means and give examples of how verification can be performed ……………………………………………………………………………………………………………… ……………………………………………………………………………………………………………… ……………………………………………………………………………………………………………… 14. Sometimes data which is used regularly is coded. Think of an appropriate code to use for the following examples: Males, Females M F Green, Red, Blue, Brown Ford, Volkswagen, Honda, Toyota Think of two advantages of coding data ……………………………………………………………………………………………………………… ……………………………………………………………………………………………………………… Think of a disadvantage of coding data …………………………………………………………………………………………………………….. 15. Explain how you could search for data in a database and give an example ……………………………………………………………………………………………………………… ……………………………………………………………………………………………………………… In order to search for data from a database, you can use ‘operators’. Complete the table below to show some of the operators which you can use. Operator Means Example > Greater than Greater than £5,000 Less than Exactly £15 <> Greater than or equal to Less than or equal to 16. Once you have found the data you need from the query, you may want to use it to create a report. Explain why this might be a good idea. ……………………………………………………………………………………………………………… ……………………………………………………………………………………………………………… DATABASES Your school keeps details of their teachers in a database. They use codes for some of the information. A copy of their main table looks like the one below: 1 2 3 5 4 Jane Jones F F BA Simon Brown Judith Mathers Lois Burns Malcolm Field David Chase Margaret Foster Sally Chadwick Patrick Roylick Richard Brand M F HI EN F F BA BA F M M F GG FR SC MA P F P P BEd PHD MSc BSc F ICT F BSc M DT F MA M RE S MA PE Some of the fields in this table might be a little hard to understand at first. The school have shortened the answers and made them into a code. What do you think the advantages of storing data as a code might be? ……………………………………………………………………………………………………………… ……………………………………………………………………………………………………………… The field headings should be: Name Gender Subject Qualification Full/Part time Which subjects do you think these codes stand for : Code Subject PE HI EN GG FR SC MA ICT DT RE The codes for qualifications are: BSc = Batchelor of Science Bed = Batchelor of Education MSc = Master of Science BA = Batchelor of Arts PHD = Doctor of Philosophy MA = Master of Arts Write the teacher’s qualifications in full Name Jane Jones Qualification Simon Brown Judith Mathers Lois Burns Malcolm Field David Chase Margaret Foster Sally Chadwick Patrick Roylick Richard Brand One piece of data is probably wrong in the database. Which one do you think it is? …………………………………………………………………… How many male teachers work at the school? …………………………………………… How many female teachers work part time? ……………………………………………… Which teacher has an MSc and is male? …………………………………………………… Which teachers are female and have a BA? ………………………………………………. The following teachers will be joining in September. Add their details to the database: Mrs Gillian White who teachers science, works full time and has a Master of Science degree Mr Julian Waite who works part time teaching history and has a Batchelor of Arts degree Name Gender Subject Qualification Full/Part time DATABASES 2 The local zoo has created a database to store records about each of the animals. A copy of their main table looks like the one below: Animal Name Gender Age Food Breed Giant Panda Pongo Giant Panda Penguin Lion Lion Crocodile Gorilla Zebra Snake Parrot Bongo Pingu Hermes Tarsa Spike Gemella Stripey Leyla Robina 8 M F M M F M F M F F 7 5 4 4 7 122 8 2 25 Bamboo Bamboo Fish Fresh meat Fresh meat Fresh meat Fruit Grass Live mice Nuts and seeds 1. How many fields are there in the zoo database? …………………………………… 2. How many records are stored in the database? ……………………………………… 3. One of the fields has been sorted into ascending order. Which field is it? ……………………………………………………………………………………… 4. One item of data in the database looks incorrect. Which one do you think it is?……………………………………………………………………. 5. Explain your answer ……………………………………………………………………………………………………………… ……………………………………………………………………………………………………………… 6. A code has been used for the ‘gender’ field. What do you think the code stands for? ……………………………………………………. 7. Why might a code be used? ……………………………………………………………………………………………………………… ……………………………………………………………………………………………………………… 8. How many animals are there in the database which are female?……………… 9. Give the names of the animals which eat fresh bamboo? ……………………………………………………………………………………………………………… 10. Give the name of the animal which eats fresh meat and is female?…………