COSC265 Flashcards

(80 cards)

1
Q

Parametric end user

A

uses existing queries - don’t create their own

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

Casual end user

A

not particularly knowledgeable, will use query builders and UI tools

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

sophisticated end user

A

is able to make complex SQL queries

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

stand-alone end user

A

Uses their own database for their own means

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

structural component

A

the relations, the cardinality, the degree, the keys

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

integrity component

A

applying correct use of primary and foreign keys, as well as the implementation of constraints in order to ensure that data can only be entered if it is valid and correct given the context of the database

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

operational component

A

CRUD operations, SQL queries, implementing transactions

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

DDL

A

Data definition language

Defines and manages objects

CREATE, ALTER, DROP

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

VDL

A

View definition language

not a formal language

Is just used to create views

uses both DDL and DML components

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

DML

A

Data manipulation language

manages the data itself

SELECT, INSERT, UPDATE, DELETE

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

phases of database design

A

requirements collection and analysis

conceptual design

logical design

physical design

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

phases of ER modelling

A

Identify entities and attributes

identify relationships and attributes thereof

examine for problems and repeat

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

degree

A

the number of attributes in a relation

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

cardinality

A

the number of tuples in a relation

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

domain constraint

A

part of integrity component of RDM

Defining the valid data for an attribute. Type and size. eg: varchar(20)

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

key constraint

A

part of integrity component of RDM

applies uniqueness rules to keys, preventing integrity errors. Also requires keys be irreducible

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

entity integrity constraint

A

part of integrity component of RDM

ensures each table has exactly one primary key, of which meets key constraints whilst also being not null

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

referential integrity constraint

A

part of integrity component of RDM

ensures there are no foreign key values that do not match a value in the referenced table

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

business constraints

A

part of integrity component of RDM

business logic such as salary rules for managers and employees

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

Division

A

smaller table must be proper subset
attribute names must be the same.

get all tuples (excluding the attributes from the subset) of which the ID has instances for each item in the subset.

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

union compatible operations

A

UNION is where you combine the values of two relations to make a single big relation, so therefore union compatibility requires both relations to have the same degree, data types, and order

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

When can updating a view update the underlying database

A

When the view is based on a simple
select X,Y,Z from table where condition;

You can also update attributes in the underlying table that aren’t in the view, so long as the selection is made based on the attribute in the view

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

EER -> RM

A

ER:
make tables for all,
weak entities = 1:m,
Binary - total participation,
1:m - m
m:n - new
multivalue = 1:m
Nary - new

EER:
one table with flags,
TP + D can be multiple tables
multiple inheritance - choose one, flag other
union: 1:m

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

DOMAIN

A

CREATE DOMAIN AgeType AS INTEGER CHECK (VALUE >= 0 AND VALUE <= 120);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
CONSTRAINT
CREATE TABLE Employees ( EmployeeID INT PRIMARY KEY, Age INT, CONSTRAINT chk_age CHECK (Age >= 18) );
26
ALTER
ALTER TABLE Employees ADD COLUMN PhoneNumber VARCHAR(15); - uses all DDL MODIFY PhoneNumber char(15); - changes types
27
DEFAULT
CREATE TABLE Orders ( OrderID INT PRIMARY KEY, OrderDate DATE DEFAULT CURRENT_DATE );
28
scalar functions
Operate on a single value and return a single value
29
LIKE
_ single % any number including 0
30
correlated/non-correlated nested queries
non-correlated means the query can be executed stand-alone as it does not rely on values from the outside query Correlated utilises aliases to allow operations within the nested query that involve relations of the outer query
31
INSERT
INSERT INTO Employees (EmployeeID, FirstName, LastName, Age, Email) VALUES (1, 'John', 'Doe', 25, 'john.doe@example.com');
32
UPDATE
UPDATE Employees SET Age = 26 WHERE EmployeeID = 1;
33
ASSERTION
CREATE ASSERTION CheckAge CHECK (NOT EXISTS (SELECT * FROM Employees WHERE Age < 18));
34
row-level triggers
has access to each row with the new and old keywords. An example of use is to add Employee-identifiable values to an audit table for each specific event. uses FOR EACH ROW.
35
statement level triggers
does not have access to the data changed. Useful for calculated values like updating salary averages.
36
trigger creation
CREATE (or REPLACE) trigger name BEFORE/AFTER/INSTEAD OF DELETE/INSERT/UPDATE ON table/view **for each row/statement** **when (condition)** begin PL/SQL block end; /
37
CIA triad
Confidentiality Someone sees something they shouldn't Integrity threats that result in the manipulation of data Availability makes the database unusable due to it being too slow (eg DDoS), or because it has broken
38
control measures
access control controlling who can see what inference control reducing someone's ability to infer information about a specific person from data available to them - eg: data aggregation in scientific databases flow control controlling what gets in and out of the database such as to prevent the individual from seeing more than what they are supposed to see as well as preventing injection attacks encryption prevents man in the middle
39
informal normalisation guidelines
1 - semantics of attributes Each tuple represents attributes relevant to only one entity. 2 - no update anomalies no redundant data or double-ups insertion, update, delete anomalies 3 - null values minimise. Put in other relations 4 - spurious tuples Make sure tables have at least one superkey, and that join conditions are made on a foreign key that is a superkey for its respective table.
40
Update anomaly
when in order to maintain consistency, each (or more than one) tuple has to be found and updated too
41
insertion anomaly
Where you want to add an instance of an entity, but the requirement of the tuple dictates you must have another unrelated entity entered - which may not exist
42
delete anomaly
when deleting one entity necessarily deletes values of another entity which you don't want to have deleted
43
lossless join
you can separate a table based on a superkey, add new values, delete some values from either table, and they can still come together as a functional table with no spurious tuples
44
functional dependency
Just like MATH120 X -> Y means each value of X maps to exactly 1 value of Y, but one value for Y can still match with multiple values of X eg: studentID -> studentName studentName -> studentID
45
reflexive
t1[x] = t2[x] y ( x t1[y] = t2[y] x->y
46
augmentation
x->y t1[x] = t2[x] t1[y] = t2[y] t1[xz] = t2[xz] contradiciton: t1[yz] =/= t2[yz] t1[z] = t2[z] y->z t1[yz] = t2[yz] - contradicts the contradiction
47
transitive
x->y t1[x] = t2[x] t1[y] = t2[y] y -> z t1[y] = t2[y] t1[z] = t2[z] therefore x -> z
48
decomposition
x->yz yz->y (reflexive, l1) yz->z (reflexive, l1) x -> y (transitive, l1, l2) x -> z (transitive, l1, l3)
49
union inference rule
given x->y x->z xz -> yz (augmentation, l1) xy-> yz (augmentation, l2) x -> xy (augmentation, l1) x -> xy -> yz x -> yz (transitive)
50
pseudotransitivity
given x->y wy->z wx->wy (augmentation) wx->z (transitive)
51
minimal cover
A set of FDs that has been reduced to remove all equivalent sets. Start with reflexivity. For FDs with multiple attr. on LHS, find closure without attr's one by one. Next check for LHS closures when whole FDs are hidden.
52
minimal set
The minimal set of relations built from a minimal cover. minimal meaning combining relations with the same primary key
53
1NF
Atomic, indivisible, unique names for attributes
54
2NF
full functional dependency. Each candidate key as a whole must determine each non-prime attribute. No attributes can be determined by just part of a candidate key
55
3NF
Transitive functional dependency. remove all transitive functional dependencies where LHS is not a candidate key and the RHS is a non-prime attribute.
56
BCNF
LHS is always a superkey. Weeds out cases where 3NF was ok because while the LHS was non-prime, the RHS was a prime attribute
57
RAID 0
1357 2468
58
RAID 1
1234 1234
59
RAID 5
pbcd apcd abpd abcp distributed parity - it doesn't matter if the parity block dies on the drive because there is none of that data on that drive. It doesnt matter if the data dies, as it can all be reconstructed with the parity blocks from the other drives
60
RAID 6
qpcd aqpd abqp pbcq 2 drives can die - distributed
61
RAID 10
RAID 1 (1234,1234) of RAID 0 (1357, 2468)
62
clustered and non-clustered indexes
Clustered indexes are based on the order the data is stored in - meaning there can only be one. There can be as many non-clustered indexes as you can make from the rest of the attributes note: the attribute used for the order of data can make insertions slower due to having to shift.
63
B+ tree order formula
order gives the number of children an internal index node can have Pp+V(p-1) <= Block where P is the size of the pointer, V is the size of the index, and p is the number of pointers in the block eg: 6p+9(p-1) <= 512 15p <= 521 p ~= 34
64
physical and logical units in oracle
Tablespace (SYSTEM/SYSAUX) datafiles segments (based on tables) extents (collections of blocks)
65
lost update
Where the second transaction updates a value before the first has written it, so the previous value is kept. The update has been lost
66
dirty read/temporary update
one of the transactions reads the value written by another transaction, but that transaction rolls back, unable to correct the transaction that has begun using incorrect data.
67
incorrect summary
aggregate function is applied with incorrect or incomplete data
68
ACID
Atomicity transaction all done in one go Consistency doesn't break any constraints Isolation Other transactions aren't affected by, nor can influence, nor reliant on for simultaneous operation Durability operation gets stored somewhere safe such that can be recreated after a failure
69
transaction
multiple operations executed upon the database as a single logical unit of work
70
canonical tree
the tree that corresponds to the SQL query before optimisation
71
phantom read
a read occurs before rows are added or removed by another transaction, that then give different results when the read occurs again
72
CRUD
Create, Read, Update, Delete
73
RAID 4
abcd abcd abcd and a parity drive
74
Transaction states
Active, failed, partially committed, committed, terminated
75
system log operations
record all read/write operations store on disk undo to backup and redo to current to restart database
76
selectivity
ratio of number of tuples that satisfy relation to the total number of tuples in the relation more specific, more efficient
77
Costs of query execution
secondary storage access cost storage cost computation cost memory usage cost communication cost
78
order of B+ tree leaf
pleaf * (Pr + Vattr) + P <= B Consider the structure - each index has a pointer, and the block has an extra pointer that points down to the next leaf (for aggregate functions, etc)
79
closure
denoted by +. all attributes determined by the attribute
80
how do you find candidate keys?
start with all attr. as superkey remove based on dependencies when smallest, see if prime attributes are determined by other FDs swap and repeat until all found