D426 - Data Management Foundations

0.0(0)
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/138

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.

139 Terms

1
New cards

database application

software that helps business users interact with database systems

2
New cards

database administrator

responsible for securing the database system against unauthorized users. A _____ enforces procedures for user access and database system availability.

3
New cards

Authorization

Many database users should have limited access to specific tables, columns, or rows of a database. Database systems authorize individual users to access specific data.

4
New cards

Rules

Database systems ensure data is consistent with structural and business rules

5
New cards

query processor

interprets queries, creates a plan to modify the database or retrieve data, and returns query results to the application.

6
New cards

Storage Manager

translates the query processor instructions into low-level file-system commands that modify or retrieve data. Database sizes range from megabytes to many terabytes, so the _____ uses indexes to quickly locate data.

7
New cards

Transaction Manager

ensures transactions are properly executed. The ______ prevents conflicts between concurrent transactions. The _______ also restores the database to a consistent state in the event of a transaction or system failure.

8
New cards

INSERT

inserts rows into a table.

INSERT INTO table_name (column_name1, column_name2, ...) VALUES (DEFAULT, 'bob', 30, 150);

9
New cards

SELECT

retrieves data from a table

SELECT column1, column2, ... FROM table_name; -- return all data from those columns.

10
New cards

UPDATE

modifies data in a table

UPDATE table_name SET column_name = 2 WHERE column_id = 3;

11
New cards

Delete

deletes rows from a table

DELETE FROM table_name; -- all rows deleted! DELETE FROM table_name WHERE column_name = 'value'; -- delete row

12
New cards

CREATE TABLE

creates a new table by specifying the table and column names.

DDL

13
New cards

Data Type

Each column is assigned a ____ that indicates the format of column values. ____ can be numeric, textual, or complex

14
New cards

INT, DECIMAL, VARCHAR, DATE

stores integer values

stores fractional numeric values

stores textual values

stores year, month, and day

15
New cards

Analysis Phase

specifies database requirements without regard to a specific database system. Requirements are represented as entities, relationships, and attributes.

16
New cards

entity

Is a person, place, activity, or thing. Singular.

17
New cards

relationship

is a link between entities, and an attribute is a descriptive property of an entity.

18
New cards

Analysis alternate names

conceptual design, entity-relationship modeling, and requirements definition.

19
New cards

logical design phase

implements database requirements in a specific database system. For relational database systems, ____ converts entities, relationships, and attributes into tables, keys, and columns.

20
New cards

physical design phase

adds indexes and specifies how tables are organized on storage media. _____ affects query processing speed but never affects the query result. The principle that _____ never affects query results is called data independence.

21
New cards

API

To simplify the use of SQL with a general-purpose language, database programs typically use an application programming interface

22
New cards

MySQL Command-Line Client

text interface included in the MySQL Server download. MySQL Server returns an error code and description when an SQL statement is syntactically incorrect or the database cannot execute the statement.

23
New cards

tuple

s an ordered collection of elements enclosed in parentheses. Ex: (a, b, c) and (c, b, a) are different, since tuples are ordered.

24
New cards

Table Data Structure

has a name, a fixed tuple of columns, and a varying set of rows

25
New cards

Column Data Structure

has a name and a data type

26
New cards

Row Data Structure

an unnamed tuple of values. Each value corresponds to a column and belongs to the column's data type

27
New cards

Data Type Data Structure

is a named set of values, from which column values are drawn

28
New cards

Data Structure Synonyms:

Table, File, Relation

Row, Record, Tuple

Column, Field, Attribute

29
New cards

Business rules

are based on business policy and specific to a particular database

30
New cards

Literals

Explicit values that are string, numeric, or binary.Strings must be surrounded by single quotes or double quotes.Binary values are represented with x'0' where the 0 is any hex value.

EX. 'String' "String" 123 x'0fa2'

31
New cards

Keywords

Words with special meaning

Ex. SELECT, FROM, WHERE

32
New cards

Identifiers

Objects from the database like tables, columns, etc.

Ex. City, Name, Population

33
New cards

Comments

Statement intended only for humans and ignored by the database when parsing an SQL statement.

Ex. -- single line comment. / multi-line Comment /

34
New cards

SQL Sublanguages

Data Definition Language (DDL) defines the structure of the database.

Data Query Language (DQL) retrieves data from the database.

Data Manipulation Language (DML) manipulates data stored in a database.

Data Control Language (DCL) controls database user access.

Data Transaction Language (DTL) manages database transactions

35
New cards

CREATE TABLE statement

creates a new table by specifying the table name, column names, and column data types

36
New cards

INT or INTEGER

integer values

37
New cards

VARCHAR(N)

Values with 0 to N Characters

38
New cards

Date

Date Values YYY-MM-DD

39
New cards

TIME

hh:mm:ss

40
New cards

DATETIME

YYYY-MM-DD HH:MI:SS

41
New cards

Decimal(M,D)

numeric values with M digits, of which D digits follow the decimal point

42
New cards

DROP TABLE

deletes a table, along with all the table's rows, from a database

DDL

43
New cards

ALTER TABLE statement

adds, deletes, or modifies columns on an existing table

DDL

44
New cards

Integer Data Types

Ex. 34 and -739448

TINYINT Signed Range: -128 to 127 Unsigned Range: 0 to 255

SMALLINT Signed Range: -32,768 to 32767 Unsigned Range: 0 to 65535

MEDIUMINT Signed Range: -8,388,608 to 8,388,607 Unsigned Range: 0 to 16,777,215

INT Signed Range: -2,147,483,647 to 2,147,483,647 Unsigned Range: 0 to 4,294,962,95

BIGINT Signed Range: -2^63 to 2^63 -1 Unsigned Range: 0 to 2^64 -1

45
New cards

Arithmetic Operators

+: Adds two numeric values

- (unary): Reverses the sign of one numeric value

-(binary): Subtracts one numeric value from another

*: Multiplies two numeric values

/: Divides one numeric value by another

%(modulo): Divides one numeric value by another and returns the integer remainder. Ex. 5%2 = 1

^: Raises one numeric value to the power of another

46
New cards

Comparison Operators

=: compares two values for equality

!=: compares two values for inequality

<: Compares two values with <

<=: Compares two values with ≤

>: Compares two values with >

47
New cards

UPDATE statement

_____ modifies existing rows in a table. The _____ uses the SET clause to specify the new column values. An optional WHERE clause specifies which rows are updated. Omitting the WHERE clause results in all rows being updated.

48
New cards

DELETE statement

_____ deletes existing rows in a table. The FROM keyword is followed by the table name whose rows are to be deleted. An optional WHERE clause specifies which rows should be deleted. Omitting the WHERE clause results in all rows in the table being deleted.

49
New cards

TRUNCATE statement

deletes all rows from a table. _____ is nearly identical to a DELETE statement with no WHERE clause except for minor differences that depend on the database system.

50
New cards

MERGE statement

selects data from one table, called the source, and inserts the data to another table, called the target.

51
New cards

primary key

is a column, or group of columns, used to identify a row. The _____ is usually the table's first column

52
New cards

simple primary key

consists of a single column

53
New cards

composite primary key

consists of multiple columns.

54
New cards

auto-increment column

is a numeric column that is assigned an automatically incrementing value when a new row is inserted.

55
New cards

Database users occasionally make the following errors when inserting primary keys:

Inserting values for auto-increment primary keys.

Omitting values for primary keys that are not auto-increment columns.

MySQL allows insertion of a specific value to an auto-increment column. However, overriding auto-increment for a primary key is usually a mistake.

56
New cards

foreign key

s a column, or group of columns, that refer to a primary key

57
New cards

FOREIGN KEY constraint

A _____ is added to a CREATE TABLE statement with the FOREIGN KEY and REFERENCES keywords. When a _____ is specified, the database rejects insert, update, and delete statements that violate referential integrity

58
New cards

Referential integrity actions

RESTRICT rejects an insert, update, or delete that violates referential integrity.

SET NULL sets invalid foreign keys to NULL.

SET DEFAULT sets invalid foreign keys to the foreign key default value.

CASCADE propagates primary key changes to foreign keys.

59
New cards

constraint

A _____ is a rule that governs allowable values in a database. ______ are based on relational and business rules,

60
New cards

Adding and dropping constraints

ALTER TABLE TableName followed by an ADD, DROP, or CHANGE clause

61
New cards

BETWEEN operator

Provides an alternative way to determine if a value is between two other values

62
New cards

LIKE operator

When used in a WHERE clause, matches text against a pattern using the two wildcard characters % and _.

% matches any number of characters. Ex: _____ 'L%t' matches "Lt", "Lot", "Lift", and "Lol cat".

63
New cards

ORDER BY clause

orders selected rows by one or more columns in ascending (alphabetic or increasing) order. The DESC keyword with the _____ orders rows in descending order.

64
New cards

Functions:

ABS(n): Returns the abzolute value of n

LOWER(s) Returns the lower case s

TRIM(s): Returns the strong s without leasing and trailing spaces

HOUR(t), MINUTE(t), SECOND(t): Returns the hour, minute or second from time t

65
New cards

Aggregate functions

COUNT() counts the number of rows in the set.

MIN() finds the minimum value in the set.

MAX() finds the maximum value in the set.

SUM() sums all the values in the set.

AVG() computes the arithmetic mean of all the values in the set.

66
New cards

HAVING clause

The _____ is used with the GROUP BY clause to filter group results.

67
New cards

JOIN

is a SELECT statement that combines data from two tables, known as the left table and right table, into a single result. The tables are combined by comparing columns from the left and right tables, usually with the = operator.

68
New cards

Alias

a column name can be replaced with an ____. The _____ follows the column name, separated by an optional AS keyword.

69
New cards

Join

Is a SELECT statement that combines data from two tables, known as the left table and right table, into a single result.

The tables are combined by comparing columns from the left and right tables, usually with the = operator.

70
New cards

INNER JOIN

combine records from two tables whenever there are matching values in a field common to both tables

71
New cards

FULL JOIN

selects all left and right table rows, regardless of match

72
New cards

Equijoins

An _____ compares columns of two tables with the = operator. Most joins are _____.

A _____ compares columns with an operator other than =, such as < and >.

73
New cards

Self-joins

joins a table to itself.

74
New cards

Cross-joins

combines two tables without comparing columns. A _____ uses a ______ clause without an ON clause.

75
New cards

subquery

sometimes called a nested query or inner query, is a query within another SQL query.

76
New cards

materialized view

a view for which data is stored at all times. Whenever a base table changes, the corresponding view tables can also change, so _____ must be refreshed.

77
New cards

WITH CHECK OPTION

When _________ is specified, the database rejects inserts and updates that do not satisfy the view query WHERE clause

78
New cards

entity-relationship model

Is a high-level representation of data requirements, ignoring implementation details

79
New cards

reflexive relationship

A ______ relates an entity to itself

80
New cards

ER diagram

Is a schematic picture of entities, relationships, and attributes. Entities are drawn as rectangles.

Attributes drawn as circles

Relationships drawn as lines

Minimum appears in parentheses

1 required

0 optional

81
New cards

entity type

An _____ is a set of things. Ex: All employees in a company.

82
New cards

Relationship Type

A _____ is a set of related things. Ex: Employee-Manages-Department is a set of (employee, department) pairs, where the employee manages the department

83
New cards

attribute type

An ______ is a set of values. Ex: All employee salaries.

84
New cards

Logical design

_____ converts the entity-relationship model into tables, columns, and keys for a particular database system.

85
New cards

Physical Design

_____ adds indexes and specifies how tables are organized on storage media.

86
New cards

Analysis steps

1. Discover Entities, relationships, and attributes

2. Determine Cardinalality

3. Distinguish strong and weak entities

4. Create supertype and subtype entities

87
New cards

Logical Design Steps (After Analysis Steps)

5. Implement Entities

6. Implement relationships

7. Implement Attributes

8. Apply normal form

88
New cards

cardinality

refers to maxima and minima of relationships and attributes.

<p>refers to maxima and minima of relationships and attributes.</p>
89
New cards

Relationship maximum

is the greatest number of instances of one entity that can relate to a single instance of another entity.

90
New cards

Relationship minimum

is the least number of instances of one entity that can relate to a single instance of another entity.

91
New cards

subtype entity, supertype entity

A _____ is a subset of another entity type, called the _____ Ex: Managers are a subset of employees, so Manager is a _____ of the Employee _____. On ER diagrams, _____are drawn within the _____. Vehicle _____ and "car" "truck" "motorcycle" _____

92
New cards

IsA relationship

The identifying relationship

93
New cards

Partitions

A _____ of a supertype entity is a group of mutually exclusive subtype entities

94
New cards

crow's foot notation

depicts cardinality as a circle (zero), a short line (one), or three short lines (many). The three short lines look like a bird's foot, hence the name "_____".

95
New cards

intangible entity

is documented in the data model, but not tracked with data in the database

96
New cards

PRIMARY KEYS SHOULD BE:

Stable. Primary key values should not change. When a primary key value changes, statements that specify the old value must also change. Furthermore, the new primary key value must cascade to matching foreign keys.

Simple. Primary key values should be easy to type and store. Small values are easy to specify in an SQL WHERE clause and speed up query processing. Ex: A 2-byte integer is easier to type and faster to process than a 15-byte character string.

Meaningless. Primary keys should not contain descriptive information. Descriptive information occasionally changes, so primary keys containing descriptive information are unstable.

97
New cards

Artificial Key

An _____ is a single-column primary key created by the database designer when no suitable single-column or composite primary key exists. Usually _____ values are integers, generated automatically by the database as new rows are inserted to the table. _____ are stable, simple, and meaningless.

98
New cards

Functional Dependence

Dependence of one column on another

99
New cards

Redundancy

Is the repetition of related values in a table.

100
New cards

Normal Forms

_____ are rules for designing tables with less redundancy