Database Design

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

1/58

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.

59 Terms

1
New cards

user requirement

define how data is handled and stored, guided by org's rules, policies, and business procedures that set constraints on data creation, updating and removal - present using ERD

2
New cards

entity relationship model

A logical representation of the data for an organization or for a business area

3
New cards

entity relationship diagram

graphical representation of ER model

4
New cards

entity type

a collection of entities that share common properties or characteristics

-denoted by rectangle

5
New cards

entity instance

single occurrence of an entity type, person, place, object, event, etc in user environment about which company wants to maintain data

6
New cards

supertype

generic entity type that has a relationship with one or more subtypes

7
New cards

subtype

subgrouping of the entities in an entity type and shares common attributes/relationships distinct from subgrouping

8
New cards

attribute inheritance

a property by which subtype entities inherit values of all attributes and instances of all relationships of their supertype

-avoid redundancy and increase simplicity

9
New cards

generalization

process of defining a more general entity type from a set of more specialized entity types

10
New cards

specialization

defining one or more subtypes of supertype

11
New cards

attributes

properties or characteristics of an entity or relationship type

-should be unique

12
New cards

identifier/key attribute

an attribute whose value distinguishes individual instances of entity type

13
New cards

relationship instance

association representing an interaction among instances of one or more entity type

14
New cards

relationship type

meaningful association between entity types

-collection of relationships that share common properties/characteristics

-glue that holds together the various components of ER model

15
New cards

degree

number of entity types participating in relationship type

16
New cards

unary relationship

relationship between instances of a single entity type (recursive)

17
New cards

binary relationship

relationship between instances of two entity types

-most common

18
New cards

tenary relationship

simultaneous relationship amond instances of 3 entity types

19
New cards

cardinality constraints

specifies the number of instances of one entity that can (or must) be associated with each instance of another entity

20
New cards

total specialization rule

each entity instance of the supertype must be a member of some subtype in the relationship

21
New cards

partial specialization rule

an entity instance of a supertype is allowed not to belong to any subtype

22
New cards

overlap rule

an instance of the supertype could be more than one of the subtypes

23
New cards

disjoint rule

an instance of the supertype can be only ONE of the subtypes

24
New cards

logical database design

transforming conceptual model into logical model.

25
New cards

relation

named two-dimensional table of data (entity)

-consists set of names column and arbitrary of unnamed rows

-not all tables are relation

26
New cards

primary key

attribute that uniquely identifies each row in relation

-cannot be null

27
New cards

composite key

primary key that consists of more than one attribute

-can be null

28
New cards

foreign key

attribute in a relation that serves as primary key of another relation

29
New cards

normalization

process of decomposing relations with anomalies to produce smaller, well-structured relations.

-eliminates redundancy, improve data integrity, minimize modification, improve workflow, lessen cost

-1NF, 2NF, 3NF

30
New cards

1NF

any multivalued attribute (repeating groups) have been removed, so there is single value at intersection of each now and column of table

31
New cards

2NF

any partial functional dependencies have been removed (nonkey attribute are identified by whole primary key)

32
New cards

partial functional dependency

exists when nonkey attribute if functionally dependent on part (not all) of primary key

33
New cards

3NF

any transitive dependencies have been removed (non key attributes are identified by only primary key)

34
New cards

data definition language (DDL)

commands that define a database, including creating, altering, and dropping tables and establishing constraints

35
New cards

CREATE

create new table or add new records to DB using INSERT

CREATE TABLE [table name]

[col name] PRIMARY KEY,

....

36
New cards

DROP

PERMANENTLY deletes DB objects and their associated data

DROP TABLE [table name]

37
New cards

ALTER

modify structure of existing DB objects - can add, modify, drop columns, constraints or indexes from table

ALTER TABLE [table name]

ADD COLUMN [col name][data type]

ALTER COLUMN [col name] SET DATA TYPE [type]

RENAME COLUMN [col name] TO [new name]

38
New cards

TRUNCATE

removes ALL records from table but keeps table structure (columns constraints)

39
New cards

data manipulation language (DML)

commands that are used for updating, inserting, modifying, and querying the data in the database. It is the core of SQL

40
New cards

INSERT

add new rows of data

INSERT INTO [table name] VALUES ('...', '...')

41
New cards

UPDATE

modifying existing records in DB

UPDATE [table name]

SET [col name] = [value]

WHERE [col name] = [value]

42
New cards

DELETE

removing records from DB - can undo

DELETE FROM [table name]

WHERE [col name] = [value]

43
New cards

data control language (DCL)

commands help a DBA control the database; they incudes commands to grant or revoke privileges to access the database or particular objects within the database and to store or remove transactions that would affect the database

44
New cards

data integrity

refers to the overall accuracy, completeness, and consistency of data

45
New cards

integrity constraints

constraints or rules limit acceptable values and actions, to facilitate maintaining the accuracy and integrity of data

46
New cards

domain constraint

specifies values that appear in a column of a relation must be from the same domain

47
New cards

entity integrity constraint

designed to ensure the every relation has a primary key and that the data values for that primary key are all valid

-Ensure the every relation has a primary key

-Data values for that primary key are all valid

48
New cards

referential integrity constraint

if there is a foreign key in one relation, either each foreign key value must match a primary key value in another relation or the foreign key value must be null

49
New cards

denormalization

combining several logical tables into one physical table to avoid the need to bring related data back together when they are retrieved from the database

-Mechanism that is often used to improve efficient processing of data and quick access to store data

-normalized database often create many tables, and joining tables slows database processing

-improve scalability

-only use if joins are such an issue

cons:

-complex update and delete operations

-potential data integrity issues

50
New cards

index

data structure thats makes looking up data more efficient

-Index is itself a table with two columns: key and address of the record(s) that contain that key value

When to use index:

-Most useful on larger tables

-Specify a unique index for the primary key of each table

-Most useful for columns that frequently appear in WHERE clauses of SQL commands

-Use an index for attributes references in ORDER BY (sorting) and GROUPBY (categorizing) clauses

Pros: Faster searches, sorting, and sometimes joins.

Cons: Takes extra space and slows down inserts/updates/deletes, because the index also has to be updated.

51
New cards

view

virtual table is created dynamically upon request by a user

CREATE VIEW name AS

SQL statement

-UPDATE, DELETE, INSERT (modifications)

52
New cards

trigger

a named set of SQL statements that are considered (triggered) when a data modification occurs or if certain data definitions are encountered

DELIMITER//

CREATE TRIGGER name [BEFORE|AFTER]

[INSERT|UPDATE|DELETE] ON table name

FOR EACH ROW

BEGIN

SQL statement

END//

DELIMITER ;

53
New cards

stored procedure

pre-written SQL program that you store in the database itself that you can that you can call and run whenever you need it.

-Encapsulate complex logic

-Reusability

-Performance

-Security

DELIMITER//

CREATE PROCEDURE name(IN para name para data type)

BEGIN

SQL statement

END//

DELIMITER ;

CALL name

54
New cards

ACID

set of properties of database transactions intended to guarantee data validity despite errors, power failures, and other mishaps

atomicity, consistency, isolation, durability

55
New cards

atomicity

transaction is all or nothing: either all steps succeed, or none do

-Achieved using transaction logs and rollback mechanisms.

-If any step fails, the database rolls back all changes.

56
New cards

consistency

transaction always leaves the database in a valid state, obeying rules and constraints.

-Enforced using constraints, triggers, and rules.

-Ensures that the database always obeys things like: Foreign keys, Unique constraints, Data types

57
New cards

isolation

transactions don’t interfere with each other; intermediate results are hidden from other transactions.

-Achieved with locking mechanisms or multiversion concurrency control (MVCC).

-Ensures that concurrent transactions don’t see each other’s intermediate states.

-Isolation levels let you balance performance vs strict isolation.

58
New cards

durability

once a transaction is committed, its changes persist, even if the system crashes immediately after.

-Achieved via write-ahead logs, commit logs, or database snapshots.

-Once a transaction is committed, it’s written to disk or non-volatile storage, so it survives crashes.

59
New cards

transaction

a sequence of database operations that satisfies the ACID properties