databases

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/86

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

87 Terms

1
New cards

Database

collection of information, model of the real world, single shared authoritative source about the domain

2
New cards

Database Management System (DBMS) Functions

stores data (insert/update/delete), access data (lookups and complex queries), standard format/language, declarative (what not how), structure data to embody domain, query processing and optimization, schema, metadata, security/privacy, concurrency control, transactions, parallelism, maintain data consistency (enforce constraints), redundancy/availability, extensibility/scalability, data distribution, recovery, interaction APIs, indexes, separates code from data, factors out core functionality that would otherwise need to be coded

3
New cards

Entity-Relationship Diagrams

diagrammatic model of the real world

4
New cards

Entities

main objects in the domain being modeled

5
New cards

Relationships

how entities interact in the domain

6
New cards

Identifying attribute

an attribute that is unique for each instance of the entity (ex: ID)

7
New cards

Derived attribute

an attribute whose value can be calculated or derived from other attributes or entities in the database

8
New cards

Set-valued attribute

an attribute that can have multiple values for a single entity (not used for values that are important enough to be entities)

9
New cards

Composite attribute

an attribute that can be broken down into smaller sub-attributes with independent meanings

10
New cards

One-to-One Relationship

each entity in one set is associated with at most one entity in the other set

11
New cards

One-to-Many Relationship

an entity in one set can be related to many entities in another set, but each entity on the other side is related to only one in the first

12
New cards

Many-to-Many Relationship

entities in both sets can have multiple associations with each other

13
New cards

Total Participation

every instance of an entity must participate in the relationship at least once

14
New cards

Partial Participation

some instances of an entity may or may not participate in the relationship

15
New cards

Aspects of Relationships

can relate an entity to itself, can have attributes, can connect more than two entities, must be uniquely identified by the collection of the entities’ identities (primary keys)

16
New cards

Weak Entities

an entity whose existence is dependent on an “owning” or “parent” entity, partial identifying attribute (primary key)

17
New cards

SQL CREATE TABLE

creates a new table in the database

18
New cards

PRIMARY KEY

a column (or set of columns) that uniquely identifies each record in a table (must be unique and not null)

19
New cards

FOREIGN KEY

a column that links one table to another by referencing a primary key in another table (establishes relationships between entities)

20
New cards

NOT NULL

a constraint that ensures a column cannot have empty values

21
New cards

UNIQUE

ensures that all values in a column are different (no duplicates allowed)

22
New cards

DEFAULT

sets a default value for a column when no value is provided

23
New cards

CHECK

a constraint that limits the values allowed in a column based on a condition (ex: age >= 18)

24
New cards

DROP TABLE

deletes a table and all its data

25
New cards

ALTER TABLE

modifies an existing table’s structure (add, remove, or change columns)

26
New cards

SELECT

retrieves data from one or more tables

27
New cards

FROM

specifies which table(s) the data is retrieved from

28
New cards

WHERE

filters rows based on a condition

29
New cards

GROUP BY

groups rows that have the same values in specified columns, often used with aggregate functions

30
New cards

HAVING

filters groups (not individual rows) created by GROUP BY

31
New cards

ORDER BY

sorts the results in ascending or descending order

32
New cards

JOIN

combines rows from two or more tables based on a related column

33
New cards

INNER JOIN

only matching rows in both tables

34
New cards

LEFT JOIN

all rows from the left table + matches from the right

35
New cards

RIGHT JOIN

all rows from the right table + matches from the left

36
New cards

FULL JOIN

all rows from both tables (matches or not)

37
New cards

INSERT INTO

adds new rows to a table

38
New cards

UPDATE

modifies existing data in a table

39
New cards

DELETE

removes rows from a table

40
New cards

DISTINCT

returns unique values in a result set

41
New cards

AS

temporarily renames a column or table

42
New cards

ON DELETE CASCADE

when a record in the parent table is deleted, all related rows in the child table are deleted

43
New cards

ON UPDATE CASCADE

when the primary key value in the parent table changes, the foreign key values in related child rows are automatically updated

44
New cards

SET NULL

sets the foreign key in child rows to null when parent is deleted/updated

45
New cards

SET DEFAULT

sets the foreign key to its default value when parent is deleted/updated

46
New cards

NO ACTION/RESTRICT

prevents deletion/update if child rows exist

47
New cards

Relation

a table in a database

48
New cards

Tuple

a single row in a relation

49
New cards

Attribute

a column in a relation

50
New cards

Schema

the structure/definition of a relation (its name and attributes)

51
New cards

Selection (σ)

filters rows based on a condition (like WHERE in SQL)

52
New cards

Projection (π)

selects specific columns (attributes) from a relation

53
New cards

Union (u)

combines tuples from two relations, removing duplicates

54
New cards

Set Difference (-)

removes tuples in one relation but not in another

55
New cards

Cartesian Product (x)

combines every tuple from one relation with every tuple from another

56
New cards

Rename (ρ)

renames a relation or its attributes

57
New cards

Join (⨝)

combines tuples from two relations based on a common attribute

58
New cards

Theta Join

join with any condition (ex: =, >, <)

59
New cards

Equi-Join

join using equality

60
New cards

Natural Join

automatically joins on all attributes with the same name

61
New cards

Intersection (∩)

returns tuples common to both relations

62
New cards

Division (÷)

find entities in one relation that are related to all tuples in another relation

63
New cards

Limitations of Relational Algebra

every input and output must be a relation (table), can’t handle individual values, does not support operations like SUM, AVG, MAX, MIN, COUNT, no grouping or sorting, results have no guaranteed order, assumes data is complete (no NULLs), can’t declare order of operations, only understands simple atomic values

64
New cards

View

a virtual table that doesn’t store data but displays data from one or more tables through a saved SQL query

65
New cards

Simplifies complex queries

can grant access to a limited view of underlying table, improving security, is stored in the schema and can be used again

66
New cards

Subquery

a query nested inside another query

67
New cards

Single-row Subquery

returns one value

68
New cards

Multi-row Subquery

returns a list of values

69
New cards

Multi-column Subquery

returns multiple columns

70
New cards

Correlated Subquery

refers to columns from the outer query, running once per outer row

71
New cards

Assertions

complex integrity constraints involving multiple rows/tables (not supported by any major DBMS)

72
New cards

Indexes

builds a data structure to facilitate efficient lookups, makes queries faster but costs more space and slower updates

73
New cards

Triggers

when an event occurs, check the condition, and if satisfied, execute the action

74
New cards

Events

insert, delete, or update on a table

75
New cards

Conditions

typically expressed via an SQL query

76
New cards

Actions

could be arbitrary code, commonly SQL Insert/Update/Delete

77
New cards

Grant Statements

used to assign privileges to roles

78
New cards

Basic Privileges

select, update(column), delete, insert, references

79
New cards

Grant + View

commonly used to grant access to certain data only to those with authority

80
New cards

Transaction Atomicity

guarantees that either all operations succeed or none are applied

81
New cards

Key-Value Store

a type of NoSQL database where data is stored as key-value pairs, each key is unique and the value can be simple or complex

82
New cards

Declarative Query Language

you describe what you want, not how to compute it (SQL)

83
New cards

With Grant Option

allows a user to grant a permission to others

84
New cards

Streaming Data Model

main data in the domain is arriving over time, events trigger actions/queries

85
New cards

Graph Databases

model data as nodes (objects/entities) and edges (connections/relationships), often used to quantify over many connection types

86
New cards

NULL = NULL

doesn’t evaluate to TRUE in SQL, it evaluates to UNKNOWN (behaving like FALSE)

87
New cards