Download Database Exam Answers

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Oracle Database wikipedia , lookup

IMDb wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Concurrency control wikipedia , lookup

Ingres (database) wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Functional Database Model wikipedia , lookup

Database wikipedia , lookup

Relational model wikipedia , lookup

ContactPoint wikipedia , lookup

Clusterpoint wikipedia , lookup

Database model wikipedia , lookup

Transcript
Name:
Databases Answers
The OCR Specification says that you should be able to:
The Database Concept


describe a database as a persistent organised store of data
explain the use of data handling software to create, maintain and interrogate
a database
The DBMS


describe how a DBMS allows the separation of data from applications and
why this is desirable
describe the principal features of a DBMS and how they can be used to
create customised data handling applications
Relational Databases





understand the relationship between entities and tables
understand the components of a relational database, such as tables, forms,
queries, reports and modules
understand the use of logical operators in framing database queries
explain the use of key fields to connect tables and avoid data redundancy
describe methods of validating data as it is input
Past Paper Exam questions
Jan 2011
1. A teacher uses a database to store the marks of pupils from all year 9 classes.
(a) PUPIL and CLASS are two entities used in this database.
Explain the term entity.



A real world object
... about which data is stored in a database
Corresponds to tables in the database
[2]
(b) The data for the first four pupils in the PUPIL table is shown below.
(i) State the primary key for the PUPIL table and explain your answer.
Primary Key
Primary Key: PupilNumber
[1]
Explanation
It is a unique identifier
Two pupils cannot have the same PupilNumber...
... but they can have the same surname, firstname or ClassCode
o
o
o
[2]
(ii) The database also contains a CLASS table. The primary key for the CLASS table
is ClassCode.
Explain why ClassCode has also been included in the PUPIL table.




ClassCode is used here as a foreign key
To link CLASS and PUPIL
Using the ClassCode, all the class details can be retrieved from the Class
table
... otherwise the class details will have to be rewritten everytime/to avoid
data redundancy
Explanations must link the two entities. e.g. “To find out in which class a pupil is” or
“to create lists of students by class” is too vague as it does not require the
ClassCode in CLASS to be the same as in PUPIL.
[3]
June 2011
2 A grocery shop uses a database with a DBMS to keep records of its stock.
(a) Explain what is meant by a DBMS.






A Database Management System/Used to manage the database
May use SQL/allows database to be queried
Provides facilities for creating tables/inserting data/viewing data/reporting
Allows data structure to be independent of the program
Allows relationships to be created between tables/Maintains integrity
Provides security features/levels of access
[3]
(b) The database uses forms and reports.
Describe each of these and give one example of how it would be used in the shop’s
database.
Form




Aninput screen
Allowing chosen data items to be displayed and edited
Uses texboxes/drop down lists/checkboxes etc…
When edited, the changes are updated in the database
[2]
Example

Suitable example from shop eg enter new products
[1]
Report




An output of the data in a database
A snapshot of the data at a given time/when printed
Of specified fields/Laid out in a specified format
Aggregates may be calculated and displayed
[2]
Example

Suitable example from shop eg weekly sales
[1]
Here is some data from the supermarket’s database.
(c) The shop runs queries using logical operators to select data for different
purposes.
(i) State the ProductID of the products in the above sample which fit the following
criteria.
Supplier = Killey’s

Answer: 0003, 0006
award 1 mark if both answers present and no others
[1]
Price > £1.00 OR Supplier = Hill Farm

Answer: 0001, 0002, 0004, 0008
Award 1 mark if 0001, 0002, 0004 are all in answer
Award 1 mark if 0002 and 0008 are in answer
Award 1 mark if 0002 is not repeated and there are no extra answers
[3]
(ii) Write the criteria which can be used to select all products which are not
discontinued and where the QuantityLeft is lower than the ReorderLevel.



Discontinued = False
AND
Quantity Left < Reorder Level
[3]
Jan 2012
3 Mrs Smith runs a dog sitting service that looks after dogs whose owners are
going away on holiday.
Mrs Smith uses a database with two tables:
• The table DOG stores the following data about each dog: DogID, name, sex,
weight, date of arrival, date of departure.
• The table JOB stores the daily jobs that she needs to do with each dog.
(a) The DOG table contains fields for the sex and weight of the dog.
(i) Describe a validation check that can be done on the sex field.

Existence check
o Male / Female (or similar) allowed
o And no other entry possible
[2]
(ii) Describe a different validation check that can be done on the weight field.

Range check
o Must be a (real) number
o Must be positive
[2]
An extract of the JOB table is shown below:
(b) Explain why DogID has been included in this table.

It is used as foreign key (in this table)
o ... the primary key of the DOG table
o to link the two tables
o allows us to find the details of the Dog to which each job relates / do
not need to re-enter dog details for each job
Not simply “to identify dog… but if they refer to the JOB table, i.e. “to identify the dog that
a job refers to” then this is the same as the 4th bullet
[3]
(c) Mrs Smith uses a query to select jobs using the following criteria:
(Time = “Afternoon”) OR (Time = “Evening”)
List the JobNumbers of the jobs that will be selected from the extract shown.
36, 37, 39 (correct answer only)
[1]
(d) Mrs Smith wants to use database management software to create a report of all
the jobs that she needs to perform on any given day, using data from the DOG and
JOB tables.
In the space below, design a layout for the report.







There is a date
There is a title
Jobs are grouped/sorted appropriately (eg by dog, time or job type)
Each job includes the Dog Name
Each job includes the Dog ID
Each Job includes the Job type
Each job includes details
[6]
June 2012
4 A DBMS is used to create customised data handling applications.
(a) State what the initials DBMS stand for.
Database management system
[1]
(b)* Describe the features of a DBMS that can be used to create customised data
handling applications and explain why using a DBMS is desirable.
The quality of written communication will be assessed in your answer to this
question.
Features
 Provides a set of tools for accessing/maintaining the database, eg to
define/create tables, run queries or define reports
 The application is independent from the data base itself
 Provides data integrity control (eg integrity checks, validation checks)
 Controls access to data, including security and multiple user access
Why desirable
 These can be set up before hand by expert and used by end user
 Separating application and database means the database can be accessed
separately by other means eg a desktop application and web application
accessing the same data / other suitable example
 Data is protected from corruption eg by multiple access
[6]
Jan 2013
5 A social networking site uses a database to store the details of the people who
have joined the site.
(a) Describe what is meant by a database.



A persistent...
... and structured/organised store of data
Allows data to be queried/interrogated.
[2]
(b) When a person joins the website, they need to enter some personal data which
is validated using rules. For example, the date of birth must be in the past.
State one rule that could be used when validating each of the following.
Email address


Must contain an @ sign
Must contain a full stop (after the @ sign).
[1]
Gender

Must be one of Male, Female, (Other).
[1]
Password


Must have a given minimum length
Must contain a non-letter.
[1]
(c) Each user can upload several pictures. Each picture has a date and a
comment.
The personal data of users is stored in a table called USER. The data about the
pictures is stored in a separate table called PICTURE.
Explain why the data about the pictures should be in a separate table, and how the
tables can be linked.





Avoids data repetition/redundancy/inconsistency...
... with the personal details of the user
... a user can have more than one picture/one to many
The primary key of the USER is stored in the PICTURE table
Where it is a foreign key.
[4]