D426 Data Management Foundations 2

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

1/70

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.

71 Terms

1
New cards

relational algebra

operations based on set theory that generate a result table from one or two input tables; these are the theoretical foundation of the SQL language

2
New cards

project (SQL operation)

selects only specified columns of a table

3
New cards

product (SQL operation)

lists all combinations of specified rows of two tables

4
New cards

join (SQL operation)

combines two tables by comparing related columns

5
New cards

union (SQL operation)

selects all rows of two tables

6
New cards

intersect (SQL operation)

selects rows common to two tables

7
New cards

difference (SQL operation)

selects rows that appear in one table but not another

8
New cards

rename (SQL operation)

changes a table name

9
New cards

aggregate (SQL operation)

computes functions over multiple table rows, such as sum and count

10
New cards

relational rules

part of the relational model and govern data in every relational database

Ex.

  • Unique primary key

  • Unique column names

  • No duplicate rows

11
New cards

business rules

based on business policy and specific to a particular database

12
New cards

SQL constraints

the methods by which relational rules and business rules are implemented on a database, which the database system then enforces, though some business rules may be enforced by applications running on the database instead

13
New cards

SQL clause

a group of SQL keywords like SELECT, FROM, and WHERE with table names like City, column names like Name, and conditions like Population > 100000

  • SELECT Name

  • FROM City

  • WHERE Population > 100000;

each has its own line

14
New cards

literals

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

15
New cards

keywords

words with special meaning

eg. select, from, where

16
New cards

identifiers

objects from the database like tables, columns, etc

17
New cards

comments

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

18
New cards

SQL sublanguages

  1. Data Definition Language (DDL)

  2. Data Query Language (DQL)

  3. Data Manipulation Language (DML)

  4. Data Control Language (DCL)

  5. Data Transaction Language (DTL)

19
New cards

DDL; Data Definition Language

an SQL sublanguage that defines the structure of the database

20
New cards

DQL; data query language

an SQL sublanguage that retrieves data from the database

21
New cards

DML; data manipulation language

an SQL sublanguage that manipulates data stored in a database

22
New cards

DCL; data control language

an SQL sublanguage that controls database user access

23
New cards

DTL; data transaction language

an SQL sublanguage that manages database transactions

24
New cards

automated script

a series of SQL statements that are prepared in advance and saved in a file or as a database stored procedure so that they can be executed repeatedly as a set by invoking the name of the file or stored procedure either by a computer program or from the SQL command line

25
New cards

database system instance

a single executing copy of a database system

26
New cards

CREATE DATABASE DatabaseName

creates a new database

27
New cards

DROP DATABASE DatabaseName

deletes a database, including all the tables in it

28
New cards

SHOW

provides database users and administrators with information about databases, the database contents (tables, columns, etc.), and server status information

29
New cards

SHOW DATABASES

lists databases available in the database system

30
New cards

SHOW TABLES

lists tables available in the currently selected database

31
New cards

SHOW COLUMNS

lists columns available in a specific table named by a FROM clause

32
New cards

SHOW CREATE TABLE

shows the CREATE TABLE statement that was used for a given table

33
New cards

USE

selects a database and is required to show information about tables within a specific database

34
New cards

table

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

35
New cards

column

has a name and a data type

36
New cards

row

an unnamed sequence of values, each of which corresponds to a column and belongs to the column’s data type/domain

37
New cards

cell

a single column of a single row

38
New cards

empty table

a table without rows

39
New cards

ALTER TABLE

adds, delete, or modifies columns on an existing table by specifying the table name followed by a clause that indicates what should be altered

40
New cards

ADD

an alter table clause that adds columns to a table

41
New cards

change

an alter table clause that changes the name and data type of an existing column

42
New cards

DROP

an alter table statement that deletes a column

43
New cards

TRANSPOSE

an alter table operation in which rows become columns and columns become rows. Not commonly applied to tables, but important for mathematical matrices.

44
New cards

LIMIT

a clause that can be added to MySQL statements to limit the number of rows returned by e.g. SELECT statements

45
New cards

WHERE

a clause that specifies a condition for selecting rows

46
New cards

fully NULL

when a simple or composite foreign key is NULL in all columns

47
New cards

referential integrity

a relational rule that requires foreign key values are either fully NULL or match some primary key value

48
New cards
  1. A primary key is updated

  2. A foreign key is updated

  3. A row containing a primary key is deleted

  4. A row containing a foreign key is inserted

Referential integrity violations

49
New cards

RESTRICT

a referential integrity action that rejects an insert, update, or delete that would violate referential integrity. The only RI action supported in MySQL for foreign key inserts and updates.

50
New cards

SET NULL

a referential integrity action that sets invalid foreign keys to NULL

51
New cards

SET DEFAULT

a referential integrity action that sets invalid foreign keys to the foreign key default value. Not supported in some MySQL configurations.

52
New cards

CASCADE

a referential integrity action that causes changes to primary keys to affect foreign keys as well.

53
New cards

ON UPDATE/ON DELETE

optional clauses of the FOREIGN KEY constraints that are followed by a referential integrity action keyword

54
New cards

primary key

a column, or group of columns, used to identify a row

55
New cards
  1. Unique

  2. Not NULL

requirements for simple primary keys to ensure that the key values identify exactly one row each

56
New cards

composite primary key

a primary key that consists of multiple columns, which are denoted with parentheses

57
New cards
  1. Unique

  2. Not NULL

  3. Minimal

requirements for composite primary keys to ensure that each value corresponds to only one row

58
New cards

PRIMARY KEY (column_name, additional_columns)

syntax for the primary key constraint

59
New cards

AUTO_INCREMENT

a constraint that can be applied to a numeric column which will cause it to assign an automatically incrementing value when a new row is inserted

60
New cards

foreign key

a column, or group of columns, that refer to a primary key on the same table or another. They may be repeated, and they may be NULL. They must follow referential integrity.

61
New cards

FOREIGN KEY (ColumnName) REFERENCES TableName(column_name)

syntax for a foreign key clause

62
New cards

constraint

a rule that governs allowable values in a database based on relational and business rules and implemented with special keywords in a CREATE TABLE statement

63
New cards

column constraint

a constraint that appears after the column name and data type in a CREATE TABLE statement and governs values in that column

Ex: NOT NULL, DEFAULT

64
New cards

table constraint

a constraint that appears in a separate clause of a CREATE TABLE statement and governs values in one or more columns

Ex: FOREIGN KEY

65
New cards

UNIQUE (ColumnName, column_name)

a constraint that ensures that values in a column, or group of columns, are unique and can be applied to either a column or as a table constraint. Violating statements are rejected.

66
New cards

CHECK (expression)

specifies an expression on one or more columns of a table and is violated if the expression is false. A NULL value causes the statement to evaluate as “unknown” and is not a violation.

67
New cards

CONSTRAINT new_name KEYWORD SYNTAX

an optional keyword available for table constraints only, which allows the user to specify a different name than the default for any constraint

68
New cards
SELECT Column_Name, Constraint_Name
FROM Information_Schema.Key_Column_Usage
WHERE Table_Name = 'TableName';

statement to have MySQL display all names of constraints on TableName, including default names

69
New cards

CHANGE CurrentColumnName NewColumnName NewDataType [ConstraintDeclaration]

clause used as part of an ALTER TABLE statement to change a named constraint

70
New cards

ADD CONSTRAINT ConstraintName ConstraintDeclaration

clause to add a constraint as part of an ALTER TABLE statement. Will fail when the table already contains data that violates the constraint

71
New cards

DROP CONSTRAINT ConstraintName

clause to drop a constraint as part of an ALTER TABLE statement