Data Management - Foundations - D426 (3/6)

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

1/103

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.

104 Terms

1
New cards

ORDER BYColumnNameDESC (clause)

The ____ keyword with the ORDER BY clause orders rows in descending order.

2
New cards

SUBSTRING(s, pos, len)(String functions)

Returns the substring from s that starts at position pos and has length len

3
New cards

DATEDIFF(expr1, expr2)(Date and time functions)

Returns expr1 - expr2 in number of days given expr1 and expr2 are date, time, or datetime values

4
New cards

CROSS JOIN(Join queries)

A cross-join uses a _____ ____ clause without an ON clause.

5
New cards

NOT EXISTS(operator)(Correlated Subqueries)

The ___ ______ operator returns TRUE if a subquery selects no rows and FALSE if at least one row is selected.

6
New cards

Save complex queries(Advantages of views)

Complex SELECT statements can be saved as a view. Database users can reference the view without writing the SELECT statement.

7
New cards

Save optimized queries(Advantages of views)

Often, the same result table can be generated with equivalent SELECT statements. Although the results of equivalent statements are the same, performance may vary. To ensure fast execution, the optimal statement can be saved as a view and distributed to database users.

8
New cards

select operation(Relational algebra)

The ______ _________ selects table rows based on a logical expression. The select operation is written as SELECT * FROM Table WHERE expression.

9
New cards

product operation(Relational algebra)

The _______ _________ combines two tables into one result. The result includes all columns and all combinations of rows from both tables. The _______ _________ is written as SELECT * FROM Table1 CROSS JOIN Table2.

10
New cards

Compatible tables(Relational algebra)

__________ ______ have the same number of columns with the same data types. Column names may be different.

11
New cards

rename operation(Relational algebra)

The ______ operation specifies new table and column names.

12
New cards

query optimizer / query execution plan (Relational algebra)

A _____ _________ converts an SQL query into a sequence of low-level database actions, called the _____ _________ ____. The _____ _________ ____ specifies precisely how to process an SQL statement.

13
New cards

Pi \n\ncorresponds to Latin letter P, for Project(Relational algebra)

14
New cards

multiplication symbol Product(Relational algebra)

Χ \n\n

15
New cards

set theory Union(Relational algebra)

∪ \n\n

16
New cards

set theory Intersect(Relational algebra)

∩ \n\n

17
New cards

rho \n\ncorresponds to Latin letter r, for Rename(Relational algebra)

ρ

18
New cards

gamma \n\n corresponds to Latin letter g, for \n Aggregate(Relational algebra)

γ

19
New cards

IN (operator)

The __ operator is used in a WHERE clause to determine if a value matches one of several values.

20
New cards

BETWEEN (operator)

The _______ operator provides an alternative way to determine if a value is between two other values. The operator is written value _______ minValue AND maxValue and is equivalent to value >= minValue AND value <= maxValue.

21
New cards

LIKE (operator)

The ____ operator, when used in a WHERE clause, matches text against a pattern using the two wildcard characters % and _.

22
New cards

LIKEBINARY (operator)

The LIKE operator performs case-insensitive pattern matching by default or case-sensitive pattern matching if followed by the __________ keyword.

23
New cards

DISTINCT (clause)

The ________ clause is used with a SELECT statement to return only unique or 'distinct' values.

24
New cards

ORDER BY (clause)

The _____ __ clause orders selected rows by one or more columns in ascending (alphabetic or increasing) order.

25
New cards

function (Numeric functions)

A________ operates on an expression enclosed in parentheses, called an argument, and returns a value. Some ________ have several arguments, separated by commas, and a few have no arguments at all.

26
New cards

argument (Numeric functions)

Usually, the ________ is a simple expression, such as a column name or fixed value.

27
New cards

ABS(n) (Numeric functions)

Returns the absolute value of n

28
New cards

LOG(n) (Numeric functions)

Returns the natural logarithm of n

29
New cards

POW(x, y) (Numeric functions)

Returns x to the power of y

30
New cards

RAND() (Numeric functions)

Returns a random number between 0 (inclusive) and 1 (exclusive)

31
New cards

ROUND(n, d) (Numeric functions)

Returns n rounded to d decimal places

32
New cards

SQRT(n) (Numeric functions)

Returns the square root of n

33
New cards

String functions(String functions)

manipulate string values.

34
New cards

CONCAT(s1, s2, ...)(String functions)

Returns the string that results from concatenating the string arguments

35
New cards

LOWER(s)(String functions)

Returns the lowercase s

36
New cards

REPLACE(s, from, to)(String functions)

Returns the string s with all occurrences of from replaced with to

37
New cards

TRIM(s)(String functions)

Returns the string s without leading and trailing spaces

38
New cards

UPPER(s)(String functions)

Returns the uppercase s

39
New cards

Date and time functions (Date and time functions)

operate on DATE, TIME, and DATETIME data types.

40
New cards

CURDATE()(Date and time functions)

Returns the current date, time, or date and time in'YYYY-MM-DD'

41
New cards

CURTIME()(Date and time functions)

'HH:MM:SS'

42
New cards

NOW()(Date and time functions)

'YYYY-MM-DD', 'HH:MM:SS', or\n'YYYY-MM-DD HH:MM:SS' format

43
New cards

DATE(expr)(Date and time functions)

Extracts the date from a date expression expr\n2013-03-25'

44
New cards

TIME(expr)(Date and time functions)

Extracts the time from a datetime expression expr\n'22:11:45'

45
New cards

DAY(d)(Date and time functions)

Returns the day from date d

46
New cards

MONTH(d)(Date and time functions)

Returns the month from date d

47
New cards

YEAR(d)(Date and time functions)

Returns the year from date d

48
New cards

HOUR(t)(Date and time functions)

Returns the hour from time t

49
New cards

MINUTE(t)(Date and time functions)

Returns the minute from time t

50
New cards

SECOND(t)(Date and time functions)

Returns the second from time t

51
New cards

TIMEDIFF(expr1, expr2)(Date and time functions)

Returns expr1 - expr2 in number of timevalues, given expr1 and expr2 are date, time, or datetime values

52
New cards

MySQL (Note)

_____ does not support table data type and table-valued functions.

53
New cards

aggregate function (Aggregate functions)

An _________ function processes values from a set of rows and returns a summary value.

54
New cards

COUNT() (Aggregate functions)

counts the number of rows in the set.

55
New cards

MIN()(Aggregate functions)

finds the minimum value in the set.

56
New cards

MAX()(Aggregate functions)

finds the maximum value in the set.

57
New cards

SUM()(Aggregate functions)

sums all the values in the set.

58
New cards

AVG()(Aggregate functions)

computes the arithmetic mean of all the values in the set.

59
New cards

GROUP BY(Clause)(Aggregate functions)

The _____ __ clause consists of the _____ __ keyword and one or more columns. Each simple or composite value of the column(s) becomes a group. The query computes the aggregate function separately, and returns one row, for each group.

60
New cards

HAVING (Clause)(Aggregate functions)

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

61
New cards

join (Join queries)

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

62
New cards

AS(aliases)

To simplify queries or result tables, a column name can be replaced with an alias. The alias follows the column name, separated by an optional __ keyword.

63
New cards

join clause(Join queries)

A ____ ______ determines how a join query handles unmatched rows. Two common join clauses are:.

64
New cards

INNER JOIN(Join queries)

selects only matching left and right table rows.

65
New cards

FULL JOIN(Join queries)

selects all left and right table rows, regardless of match.

66
New cards

ON (Join queries)

The __clause specifies the join columns.

67
New cards

LEFT JOIN(Join queries)

selects all left table rows, but only matching right table rows.

68
New cards

RIGHT JOIN(Join queries)

selects all right table rows, but only matching left table rows.

69
New cards

outer join (Join queries)

An _____ ____ is any join that selects unmatched rows, including left, right, and full joins.

70
New cards

UNION(Join queries)

The _____ keyword combines the two results into one table.

71
New cards

MYSQL (Note)

_____ supports INNER, LEFT, and RIGHT JOIN but not FULL JOIN.

72
New cards

equijoin(compareoperator)

An ________compares columns of two tables with the = operator.

73
New cards

non-equijoin(compareoperator)

A ___-________compares columns with an operator other than =, such as < and >.

74
New cards

self-join (Join queries)

A ____-____ joins a table to itself.

75
New cards

cross-join(Join queries)

A _____-____ combines two tables without comparing columns.

76
New cards

subquery/nested query/inner query(Subqueries)

is a query within another SQL query.

77
New cards

correlated(Correlated subqueries)

A subquery is __________ when the subquery's WHERE clause references a column from the outer query.

78
New cards

alias (Aliases)

An _____ is a temporary name assigned to a column or table.

79
New cards

AS (Aliases)

The __ keyword follows a column or table name to create an alias.

80
New cards

EXISTS (operator)(Correlated Subqueries)

Correlated subqueries commonly use the ______ operator, which returns TRUE if a subquery selects at least one row and FALSE if no rows are selected.

81
New cards

flattening (Join queries)

Replacing a subquery with an equivalent join is called ___________ a query.

82
New cards

view table / view query (view tables)

A ____ table is a table name associated with a SELECT statement, called the ____ query.

83
New cards

CREATE VIEW(view tables)

The _____ ____ statement creates a view table and specifies the view name, query, and, optionally, column names. If column names are not specified, column names are the same as in the view query result table.

84
New cards

base table(Querying views)

A table specified in the view query's FROM clause is called a ____ table.

85
New cards

materialized view(Querying views)

A ____________ view is a view for which data is stored at all times.

86
New cards

Protect sensitive data (Advantages of views)

A table may contain sensitive data.

87
New cards

Primary keys (Inserting, updating, and deleting views issues)

If a base table _______ ___ does not appear in a view, an insert to the view generates a NULL _______ ___ value. Since _______ ___s may not be NULL, the insert is not allowed.

88
New cards

Aggregate values (Inserting, updating, and deleting viewsissues)

A view query may contain _________ ______ such as AVG() or SUM(). One aggregate value corresponds to many base table values. An update or insert to the view may create a new aggregate value, which must be converted to many base table values. The conversion is undefined, so the insert or update is not allowed.

89
New cards

Join views(Inserting, updating, and deleting viewsissues)

In a ____ _____, foreign keys of one base table may match primary keys of another. A delete from a view might delete foreign key rows only, or primary key rows only, or both the primary and foreign key rows. The effect of the join view delete is undefined and therefore not allowed.

90
New cards

WITH CHECK OPTION (clause)

When ____ _____ ______ is specified, the database rejects inserts and updates that do not satisfy the view query WHERE clause.

91
New cards

relational algebra (Relational algebra)

In his original paper on the relational model, E. F. Codd introduced formal operations for manipulating tables. Codd's operations, called _________ _______, have since been refined and are the theoretical foundation of SQL.

92
New cards

project operation(Relational algebra)

The _______ _________ selects table columns. The _______ _________ is written as SELECT Column1, Column2, ... FROM Table.

93
New cards

join(Relational algebra)

The ____ operation, denoted with a "bowtie" symbol, is written as SELECT * FROM Table1 INNER JOIN Table2 ON expression.

94
New cards

theta join (Relational algebra)

Because of theta notation, the join operation is sometimes called a _____ ____.

95
New cards

set operations(Relational algebra)

Union, intersect, and difference operate on compatible tables and, collectively, are called ___ __________.

96
New cards

union(Relational algebra)

The _____ operation combines all rows of two compatible tables into a single table. Duplicate rows are excluded from the result table. The _____ operation is written asSELECT FROM Table1 UNION SELECT FROM Table2.

97
New cards

Intersect(Relational algebra)

_________ operates on two compatible tables and returns only rows that appear in both tables. The _________ operation is written as SELECT FROM Table1 INTERSECT SELECT FROM Table2.

98
New cards

difference(Relational algebra)

The ___________ operation removes from a table all rows that appear in a second compatible table. The ___________ operation is written as SELECT FROM Table1 MINUS SELECT FROM Table2.

99
New cards

aggregate operation(Relational algebra)

The __________ operation applies aggregate functions like SUM(), AVG(), MIN(), and MAX(). The __________ operation is written as SELECT GroupColumn, Function(Column) FROM Table GROUP BY GroupColumn.

100
New cards

equivalent (Relational algebra)

Relational algebra expressions are __________ if the expressions operate on the same tables and generate the same result.