1.3.2 Databases Flashcards

1
Q

Entity

A

Item of interest about which information is stored

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Relational Database

A

Contains different tables for each entity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a Flat File?

A

Database that consists of a single file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are flat files most likely based around?

A

A single entity and its attributes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How are flat files written out? Describe each part.

A

__Entity1__(Attribute1, Attribute2, Attribute3…)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a primary key?

A

A unique identifier for each record in a table.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How do we show the primary key?

A

By underlining it

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Foreign Key

A

An attribute which links two tables together. The foreign key will exist in one table as the primary key, and act as the foreign key in the other.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How do we show the foreign key?

A

By using an asterisk

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Secondary key

A

Allows a database to be searched quickly

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

ER Modelling

A

A visual way of describing data tables and the relationships between them.

They can be used to reduce redundancy and construct a relational database.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are the three kinds of relationships in ER modelling?

A

One-to-one (eg Husband —- Wife)
One-to-many (eg Mother —< Children)
Many-to-many (eg Students >–< Courses)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Normalisation

A

The process of optimally designing data tables by reducing data redundancy and repetition by converting them into normal forms.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Benefits of normalisation [4]

A
  • No redundancy
  • Consistent data throughout linked tables
  • Records can be added and removed without issues
  • Complex queries can be carried out
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are the three types of normalisation?

A

First Normal Form
Second Normal Form
Third Normal Form

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

First Normal Form

A
  • Each field contains a single value
  • Each field contains the same data type
  • No duplicate records
  • All field names are unique
  • Table must have a primary key
17
Q

Second Normal Form

A

A table in 1NF that has no partial dependencies (data that repeats across multiple records removed and put into a new table with appropriate relationships)

18
Q

Third Normal Form

A

A table in 2NF where all attributes that are not the primary key are fully dependent on the primary key (no non-key dependencies).

19
Q

What is Indexing? What is it used to do?

A
  • A method used to store the position of each record ordered by a certain attribute.
  • This is used to look up and access data quickly.
20
Q

Which key is automatically indexed?

A

Primary key

21
Q

Do we typically use the primary key for queries? Why or why not?

A

No. The primary key is normally not remembered. Secondary keys are used. They are indexed to make the table easier and faster to search through on those particular attributes.

22
Q

A bank needs to scan cheques. What data capturing method can they use?

A

Magnetic Ink Character Recognition. All the details on the cheque excluding the amount are printed in a special magnetic ink that can be recognised by the computer. The amount should be entered manually.

23
Q

A school wants to automatically mark multiple choice questions. What data capturing method can they use?

A

Optical Mark Recognition

24
Q

What are the four ways of capturing data to be entered into a database?

A

Manual.
Optical Mark Recognition
Optical Character Recognition
Magnetic Ink Character Recognition

25
Q

What is a common way of exchanging data?

A

Electronic Data Interchange

26
Q

What is good about Electronic Data Interchange?

A

It doesnt require human interaction, and enables data transfer from one computer to another.

27
Q

What is Structured Query Language used for?

A

Manipulating databases.

28
Q

What does the following SQL do?

SELECT MovieTitle, DatePublished
FROM Movie
WHERE DatePublished BETWEEN #01/01/2000# AND #31/12/2005#
ORDER BY DatePublished;

A

Two attributes are chosen: MovieTitle and DatePublished from the table known as Movie.

It will only select records where the value of DatePublished is between 01/01/2000 and 31/12/2005.

Lastly, it will order these records in ascending order. It won’t be descending order because ‘Desc’ is not present at the end of ORDER BY DatePublished.

29
Q

SQL Syntax: ORDER BY

A

Specifies whetehr you want it in ascending or descending order. By default, values are in ascending order. Adding Desc to the end causes them to be descending.

ORDER BY DatePublished Desc

30
Q

SQL Syntax: JOIN

A

It allows you to combine rows from multiple tables based on a common field between them.

31
Q

What does this SQL code do?

SELECT Movie.MovieTitle, Director.DirectorName, Movie.MovieCompany
FROM Movie
JOIN Director
ON Movie.DirectorName = Director.DirectorName

A

It selects the MovieTitle attribute belonging to the movie table, the director name attribute belonging to the director table, and the moviecompany attribute belonging to the movie table as well.

The two tables movie and director are joined.

The On keyword at the end describes the common field between the two tables.

32
Q

SQL Syntax: CREATE

A

Allows you to make new databases. The following details about each attribute must be specified: Data type, whether it must be filled in (not null), and if it is the primary key.

33
Q

What does this SQL code do?

CREATE TABLE TableName
(
Attribute1 INTEGER NOT NULL, PRIMARY KEY,
Attribute2 VARCHAR(20) NOT NULL,
)

A

Creates a new table called TableName, with two attributes (Attribute1, Attribute2).
Attribute1 is an integer. It is not null, meaning it must be filled in. It is a primary key.
Attribute 2 is a string of length 20. It is not null, meaning it must be filled in.