CS22001 - Database Systems

0.0(0)
Studied by 23 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/281

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 5:05 PM on 5/11/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

282 Terms

1
New cards

How can you show a model of a relational database?

An ERD (entity relationship diagram)

2
New cards

What is a general rule for determining entities?

Look for nouns

3
New cards

What is a general rule for determining attributes?

Find info that each entity would contain

4
New cards

What is a general rule for determining relationships?

Look for verbs

5
New cards

What are the steps for creating a database?

Requirements, Conceptual Design, Logical Design, Physical Design, Verification, Maintenance

6
New cards

Which step does an ERD fall under?

Conceptual Design

7
New cards

What is a weak entity?

An entity that would not exist without another

8
New cards
<p>Which entity is a weak entity?</p>

Which entity is a weak entity?

Contact Info

9
New cards

What is 1NF?

Every attribute in that relation is single-valued attribute

10
New cards

What is 2NF?

Every non-primary-key attribute is fully functionally dependent on the primary key

11
New cards

What is 3NF?

No transitive dependency for non-prime attributes

12
New cards

What is a candidate key?

A minimal set of attributes which uniquely identifies each record

13
New cards

What is a composite key?

A candidate key which consist of two or more attributes

14
New cards

What is a primary key?

A candidate key which is selected to uniquely identify each record

15
New cards

What makes a good primary key?

One attribute, a numerical attribute, named sensibly

16
New cards

What is a foreign key?

When one table has the primary key

17
New cards

What is the purpose of a foreign key?

Allows tables to be linked without physically storing the relationship

18
New cards

What is a requirement of a joining table?

Both entities have many to many relationships

19
New cards

What is the purpose of a joining table?

To model many-to-many relationships by breaking them into two one-to-many relationships

20
New cards

When does an insertion anomaly occur?

Specific data cannot be added to a table without the presence of unrelated or incomplete data

21
New cards

When does an update anomaly occur?

When data is duplicated (redundant) across multiple records, and updating only some - but not all - of those records leaves the database in an inconsistent state

22
New cards

When does a deletion anomaly occur?

When deleting a record from a database unintentionally removes other crucial, unrelated data, causing loss of information

23
New cards

What is CRUD?

Create, read, update, delete

24
New cards

Create in SQL (2)

CREATE

INSERT INTO

25
New cards

Read in SQL

SELECT

26
New cards

Update in SQL

UPDATE

27
New cards

Delete in SQL

DELETE

28
New cards

Example insert in SQL

INSERT INTO Staff (Name, Address, Phone) VALUES ('Daniel Rough', 'Room 2.07', '384145')

29
New cards

Example update in SQL

UPDATE Staff SET Address = 'Room 2.05’, 	 Phone ='123456' WHERE Name ='Daniel Rough'

30
New cards

Example delete in SQL

DELETE FROM Staff WHERE Name ='Daniel Rough'

31
New cards

Select statement format in SQL

SELECT columns
	FROM TableName
	WHERE condition

32
New cards

Keywords SQL (6)

SELECT, FROM, WHERE, GROUP BY, ORDER BY, LIMIT

33
New cards

SELECT Aggregates in SQL

COUNT, SUM, AVG, MIN, MAX

34
New cards

What kind of join is this?

INNER

35
New cards

What kind of join is this?

FULL OUTER

36
New cards

What kind of join is this?

LEFT OUTER

37
New cards

What kind of join is this?

RIGHT OUTER

38
New cards

What is a view?

The dynamic result of one or more relational operations operating on the base relations to produce another relation

39
New cards

True/False views are read only

False (can be read only or updateable)

40
New cards

Why are views useful? (2)

To hide complexity and increase security

41
New cards

What does a horizontal view do?

Restricts the rows (records) of a table

42
New cards

What does a vertical view do?

Restricts the columns (attributes) of a table

43
New cards

Digression

Each column must have a specified type, such as numeric, string, date/time or binary. Choosing the correct data type is critical for performance, storage efficiency, and data integrity

44
New cards

What CRUD for vertical view?

CRUD

45
New cards

What CRUD for horizontal view?

RU

46
New cards

What is a transaction?

A sequence of one or more SQL operations treated as a single, atomic logical unit of work

47
New cards

What are the two possible outcomes of a transaction?

Commit, rollback

48
New cards

What is integrity in databases?

Accuracy and reliability of the data

49
New cards

What is Domain Integrity?

A set of database rules ensuring data accuracy, validity, and consistency within a specific column

50
New cards

Why cant an INT variable store ‘Hi’?

Domain integrity

51
New cards

What does Domain Integrity restrict?

Input values (to allowed types, formats, or ranges)

52
New cards

Why is Domain Integrity useful?

It acts as a primary defence against invalid data entry (maintaining reliable database functionality)

53
New cards

What are the requirements for Entity Integrity? Every entity must have a:

Primary Key

54
New cards

True/False primary keys must be NOT NULL

True

55
New cards

What does Referential Integrity do?

Ensures data consistency by guaranteeing that relationships between tables remain valid

56
New cards

What is an example needing Referential Integrity?

Assigning an order to a non-existent customer

57
New cards

What is User Defined Integrity?

A set of customised rules, constraints, or validation criteria

58
New cards

What does ACID stand for?

Atomicity, Consistency, Isolation, Durability

59
New cards

What is atomicity?

Either all the operations in a transaction are successful, or none of them are

60
New cards

What is consistency?

A transaction always leaves the database in a consistent state - no integrity constraints are violated and the new updated records are immediately available

61
New cards

What is isolation?

Transactions should execute as if there are no other concurrently running transactions

62
New cards

What is durability?

Once a transaction has committed, it is not lost due to any subsequent failure

63
New cards

What does LUW stand for?

a Logical/Least Unit of Work

64
New cards

What does LUW mean?

Either everything is completed or nothing is

65
New cards

T/F a transaction is a LUW

True

66
New cards

What are the steps (keywords) of transactions in SQL?

START TRANSACTION, COMMIT, ROLLBACK

67
New cards

What does START TRANSACTION indicate in SQL?

The entry point of a LUW

68
New cards

What does COMMIT indicate in SQL?

The end point and makes changes in LUW permanent and logged

69
New cards

What does ROLLBACK indicate in SQL?

Undoes all committed changes in LUW back to the START

70
New cards

What is the end result of ROLLBACK in SQL?

No change - like the transaction never started

71
New cards

What does concurrency control allow?

Multiple transactions or processes to run simultaneously without interfering with each other

72
New cards

What potential problems does concurrency control solve? (4)

Lost update, uncommitted dependency, inconsistent analysis, deadlock

73
New cards

What is the lost update problem?

When two or more transactions select the same record, read it, and then update it simultaneously one transaction overwrites the other and the first update is lost

<p><span>When two or more transactions select the same record, read it, and then update it simultaneously one transaction overwrites the other and the first update is lost</span></p>
74
New cards

What is the uncommitted dependency problem?

When a transaction reads data that is later modified by another transaction before the first transaction commits

<p><span>When a transaction reads data that is later modified by another transaction before the first transaction commits</span></p>
75
New cards

What is the inconsistent analysis problem?

Where one transaction reads data while another modifies it

<p>Where one transaction reads data while another modifies it</p>
76
New cards

What is the deadlock problem?

When both transactions keep waiting on each other to finish

<p>When both transactions keep waiting on each other to finish</p>
77
New cards

Why is security of data important?

Data is valuable and private, and unauthorised users can damage database integrity

78
New cards

What is a threat (according to that book)?

Any situation or event, whether intentional or accidental, that may adversely affect a system and consequently the organisation

79
New cards

Name 3 types of security

Data, network, physical

80
New cards

What are the worst causes of bad security?

Weak authentication, poor database configuration, SQL injection

81
New cards

How can SQL injection be prevented?

Prepared statement, input sanitisation,

82
New cards

What do prepared statements do?

Separates the query structure (the SQL) from the actual data (user input)

83
New cards

What does the input WHERE UserID = 456 OR 1=1 look up when prepared statements are used?

UserID that is ‘456 OR 1=1’

84
New cards

What does the input WHERE UserID = 456 OR 1=1 look up when prepared statements are NOT used?

Nothing as 1=1 is always true

85
New cards

What is input sanitisation?

The security process of cleaning, filtering, or modifying user input to ensure only valid characters are input

86
New cards

What is the definition of a distributed database?

A logically inter-related collection of shared data (and a description of this data), which is physically distributed over a computer network

<p>A logically inter-related collection of shared data (and a description of this data), which is physically distributed over a computer network</p>
87
New cards

What is the definition of a DDBMS (Distributed Database Management System)?

A software system which permits the management of the distributed database and makes the distribution transparent to users

<p>A software system which permits the management of the distributed database and makes the distribution transparent to users</p>
88
New cards

Fill in the blanks:

Data is split into ………(1)
………(1) may be ……….(2)
Fragments are allocated to ……(3)
….. (3) are linked by a communications …….(4)

fragments, replicated, sites, network

89
New cards

What is horizontal fragmentation?

Splitting tables up by records (rows)

<p>Splitting tables up by records (rows)</p>
90
New cards

What is vertical fragmentation?

Splitting up tables by attributes (columns)

<p>Splitting up tables by attributes (columns)</p>
91
New cards

What is hybrid fragmentation?

Splitting up tables by records and attributes

92
New cards

What is a centralised database?

A single database and DBMS stored at one site with users distributed across the network

<p>A single database and DBMS stored at one site with users distributed across the network</p>
93
New cards

What are the two main types of distributed database?

Partitioned, complete

94
New cards

What is partitioned replication in a distributed database?

Database is partitioned into disjoint fragments; each fragment is assigned to one site

<p>Database is partitioned into disjoint fragments; each fragment is assigned to one site</p>
95
New cards

What is complete replication in a distributed database?

A complete copy of the database is maintained at each site

<p>A complete copy of the database is maintained at each site</p>
96
New cards

What is selective replication in a distributed database?

A combination of partitioning, replication and centralisation

<p>A combination of partitioning, replication and centralisation</p>
97
New cards

Centralised comparison: Locality of reference, Reliability & Availability, Performance, Storage Costs, Communication Costs

Lowest, Lowest, Unsatisfactory, Lowest, Highest

98
New cards

Partitioned comparison: Locality of reference, Reliability & Availability, Performance, Storage Costs, Communication Costs

High, Low for item; high for system, Satisfactory, Low, Low

99
New cards

Complete replication comparison: Locality of reference, Reliability & Availability, Performance, Storage Costs, Communication Costs

Highest, Highest, Best for read, Highest, High for update; low for read

100
New cards

Selective replication comparison: Locality of reference, Reliability & Availability, Performance, Storage Costs, Communication Costs

High, OK for item; high for system, Satisfactory, Average, Low