4.10 Fundamentals of databases Flashcards

(26 cards)

1
Q

what is an entity and attributes

A

an entity is a real-world object or a concept in a database that data is stored about
an attribute is a piece of information that describes the entity

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

what is a database

A

an organised collection of data that can be accessed, managed and updated - they consist of multiple tables where each table stores data about a specific entity, in a table each row represents one instance of the entity and each column holds an attribute describing that entity

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

what is the form of an entity description

A

entity_name (entitiy_identifier, attribute1, attribute2)

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

what is a relational database

A

when tables in a database can be linked with a common attribute

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

what are the three types of relationships between tables

A

one-to-one - each item has another item e.g each car has an owner
one-to-many - each item has many items e.g each car has many passengers
many-to-many - many items have many items e.g a driver can have many cars and a car can have many drivers

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

what is a primary key

A

an attribute that provides a unique identifier for each entity in the table

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

what is a foreign key

A

a primary key from another table used to link the two tables together

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

what is a composite primary key

A

a primary key made up of two or more fields in a table that together uniquely identify a record

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

why are databases normalised

A

to reduce data redundancy, prevent update anomalies and ensure data is stored efficiently and consistently - therefore faster searching and sorting

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

what is first normal form

A

requires that all fields in a table does not contain repeating attributes - data is also atomic (single column only contains one value)

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

what is second normal form

A

first normal form must also be satisfied, every non-key field depends on the whole primary key, not just part of it - important when the primary key has more than one field (a composite key)

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

what is third normal form

A

second normal form must also be satisfied, all non-key fields are only dependent on the primary key, not on other non-key fields

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

SQL to retrieve data from a table

A

SELECT <attribute> FROM <table> WHERE <condition> ORDER BY <ASC/DESC></condition></attribute>

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

SQL to update data in a table

A

UPDATE <table> SET <attribute> = <value> WHERE *<attribute> = <value>*
* - primary key</value></attribute></value></attribute>

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

SQL to delete data from a table

A

DELETE FROM <table> WHERE <condition></condition>

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

SQL to insert data into a table

A

INSERT INTO <table> VALUES (<value1>,<value2>)</value2></value1>

17
Q

What is a wildcard in SQL commands

A

used to specify all attributes - notated with an asterix (*)

18
Q

how to define a table using SQL

A

CREATE TABLE <table_name>(<attribute><type>,<attribute><type>, PRIMARY KEY (<attribute>)) - when defining primary key the attribute should already be defined</attribute></type></attribute></type></attribute></table_name>

19
Q

what are the data types and how to define in SQL

A

fixed length string : CHAR(size) - string with specific size

variable length string: VARCHAR(size) - string with number of characters up to specified size

integer: INT(size) - whole number with number of bits specified

number with fractional part: FLOAT(size, precision) - number stored using number of bits specified and number of digits after decimal point also specified

date: DATE - format YYYY-MM-DD

date and time : DATETIME - format YYYY-MM-DD HH:MM:SS

time: TIME - format HH:MM:SS

year: YEAR - either YY or YYYY

20
Q

describe a client server database system

A

provides simultaneous access to the database for multiple clients

21
Q

what is a concurrent access problem and what can occur because of this

A

when two users attempt the same field at the same time, can lead to database updates being lost

22
Q

what are the ways that concurrent access problems can be managed

A

record locks, serialisation, timestamp ordering, commitment ordering

23
Q

how are record locks used to manage concurrent access

A

when a record is accessed by a user, it is immediately locked to other users until the first user has finished

24
Q

how is serialisation used to manage concurrent access

A

requests from other users are places in a queue

25
how is timestamp ordering used to manage concurrent access
each request is assigned a timestamp which marks the time that the command was initiated - requests take place in that order
26
how is commitment ordering used to manage concurrent access
an algorithm is used to work at the optimum order of requests - the algorithm considers the impact of commands on other parts of the database and attempts to minimise issues from occurring with the database