10 Fundamentals of Databases Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Define attribute

A

A property of an entity equivalent to a field in a table

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

Define entity

A

Any item in the system about which data is stored

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

Define primary key

A

An attribute that uniquely identifies each record in a table

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

Define composite key

A

A primary key that involves more than one attribute

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

Define foreign key

A

A primary key in another table to create a relationship

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

What are the properties of a first normal form?

A
  • No repeating attributes or groups of attributes
  • all attributes must be atomic (cannot consist of two data item e.g. first name and surname
  • this would make it difficult to order by surname
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are the properties of a second normal form?

A
  • In first normal form
  • With no partial dependencies
  • (this only occurs if primary key is a composite key)
  • the value of the non-key attribute can be determined by a subset of the primary key but not the entire key
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are the properties of a third normal form?

A
  • Second normal form
  • No non-key dependencies
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

SQL syntax for retrieving data

A

SELECT attribute FROM table

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

SQL syntax for relational database

A

SELECT attributes FROM tables
JOIN table2
ON table1.primarykey = table2.foreignkey

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

SQL syntax to order results

A

SELECT attribute FROM table
WHERE attribute2 = 10
ORDER BY attribute ASC

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

SQL syntax to create a new table

A

CREATE TABLE Customers
(
CustomerID CHAR(4) NOT NULL PRIMARY KEY,
FirstName VARCHAR(20) NOT NULL,
Surname VARCHAR (50) NOT NULL,
PricePaid CURRENCY
Height FLOAT (5, 2) #float with 5 digits and max of two after decimal
)

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

SQL syntax to add attribute

A

ALTER TABLE Customers
ADD Age INT

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

SQL syntax to delete attribute

A

ALTER TABLE Customers
DROP Height

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

SQL syntax to alter data type of attribute

A

ALTER TABLE Customers
MODIFY COLUMN Surname VARCHAR(40) NOT NULL

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

SQL syntax to insert a new record

A

INSERT INTO Customers(CustomerID, Firstname, Surname)
VALUES (“8472”, “Alice”, “Wonderland”)

17
Q

SQL syntax to delete a record

A

DELETE FROM Customers
WHERE CustomerID = “2342”

18
Q

SQL syntax to update a record

A

UPDATE Customers
SET Surname = “Borderland”
WHERE CustomerID = “8462”

19
Q

What are the benefits of normalisation?

A
  • Easier to maintain and update a normalised database
  • No unnecessary duplication of data
  • Data integrity is maintained e.g. if a person changes their address, the update only needs to be made to one table
  • Smaller tables and fewer fields means faster searches and saves storage
20
Q

Define client-server database.

A

A system that provides simultaneous access to the database for multiple clients

21
Q

Define normalisation.

A

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

22
Q

What are the strengths of client-server databases?

A
  • Consistency of database is maintained as only one copy is held
  • Backup and recovery - as the database is centralised, a server admin can create backups so that if there’s a failure or loss of data the database can be recovered with little or no consequences
  • Centralised security - limiting and controlling access levels can preserve the integrity of the data in the database
23
Q

What are the techniques used to handle simultaneous database transactions?

A
  • Record locking
  • Timestamp ordering
  • Commitment ordering
24
Q

Describe record locking.

A

Prevents simultaneous access to objects in a database to prevent updates being lost or inconsistencies in the data arising

  • Record is locked when a user retrieves it for editing or updating
  • Anyone else attempting to retrieve it is denied access until the transaction is completed
25
Q

Outline serialisation and timestamp ordering

A
  • Serialisation ensures that transactions do not overlap in time
  • Every object in the database has a read and a write timestamp which are updated when an object is read or written
  • When a user tries saving an update, if the read timestamp is not the same as the start of the transaction, we know that another user has accessed it and will cancel the update
26
Q

Explain commitment ordering.

A
  • Transactions are ordered in terms of their dependencies on one another as well as the time they were initiated
27
Q

Outline the system life cycle approach.

A

Each stage has to be completed before the next one can begin

28
Q

Outline the agile approach.

A
  • More modern and flexible approach
  • Gets feedback from user throughout development of a system
  • Adjustments can be made at each stage
29
Q

Benefits of agile approach.

A
  • User is not sure what is possible so they cannot clearly define requirements
  • Analyst may misunderstand the wishes of the user/client
  • Usually it is easier to identify drawbacks with the prototype rather than expressing what you expect in advance
  • Expensive and time-consuming to make changes to a final product