D426: Data Management Foundations 3

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

IN operator

used in a WHERE clause to determine if a value matches one of several in a list

2
New cards

WHERE ColumnName IN (value1, value2, …)

syntax for IN clause

3
New cards

BETWEEN operator

provides an alternate way to determine if a value is between two other values; is inclusive

4
New cards

LIKE operator

used in a WHERE clause to match against two wildcard characters

5
New cards

%

wildcard character that can stand in for any number of characters

6
New cards

_

wildcard character that stands in for only a single character

7
New cards

LIKE BINARY

case sensitive version of the LIKE operator

8
New cards

DISTINCT clause

used with a SELECT statement to return only values that are unique given the column or combination of columns passed to the clause

9
New cards

ORDER BY clause

sorts values by a specific column in either ascending or descending (DESC) order; sort levels are ordered by the order of the columns

10
New cards

RAND()

generates a random number from within the set [0, 1)

11
New cards

REPLACE(‘s’, from, to)

returns ‘s’ with all occurrences of ‘from’ replaced with ‘to’

12
New cards

SUBSTRING(‘s,’ pos, len)

returns the substring from ‘s’ that is len characters long and starts with the character at position pos

13
New cards

TRIM(s)

returns string ‘s’ with extra white space removed

14
New cards

UPPER(‘s’)

returns ‘s’ in all caps

15
New cards

LOWER(‘s’)

returns ‘s’ as all lowercase letters

16
New cards

CONCAT(s1, s2, …)

returns the string arguments as one combined string

17
New cards

CURDATE()

returns current date in format ‘YYYY-MM-DD’

18
New cards

CURTIME()

returns current time in format ‘HH:MM:SS’

19
New cards

NOW()

returns current time and date in format ‘YYYY-MM-DD HH:MM:SS’

20
New cards

DATE(expr)

extracts the date from a date or datetime expression

21
New cards

TIME(expr)

extracts the time from a time or datetime expression

22
New cards

DAY(d)

returns the day from date “d”

23
New cards

MONTH(d)

returns the month from date “d”

24
New cards

YEAR(d)

returns the year from date “d”

25
New cards

HOUR(t)

returns the hour from time “t”

26
New cards

MINUTE(t)

returns the minute from time “t”

27
New cards

SECOND(t)

returns the seconds value from time “t”

28
New cards

DATEDIFF(expr1, expr2)

returns the value of expr1 - expr2 in days

29
New cards

TIMEDIFF(expr1, expr2)

returns the value of expr1 - expr2 in time values

30
New cards

GROUP BY

appears between the WHERE and ORDER BY clauses of a SELECT statement and defines columns whose values should be used to define the groupings for an aggregate function. One row will be returned for each group.

31
New cards

HAVING clause

used with the GROUP BY clause to filter group results

32
New cards

join

a select statement that combines data from two tables into a single result by comparing the values in two columns with the same data type, usually primary and foreign keys

33
New cards

AS

keyword to define a column alias to distinguish columns that would otherwise have the same name after a join statement

34
New cards

INNER JOIN

selects only matching left and right table rows

35
New cards

FULL JOIN

selects all left and right table rows, regardless of match. Unmatched left table rows appear with NULL values in right table columns and vice versa. Not supported in MySQL.

36
New cards

ON clause

specified join columns of two tables

37
New cards

LEFT JOIN

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

38
New cards

RIGHT JOIN

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

39
New cards

outer join

any join that selects unmatched rows, including left, right, and full jions

40
New cards

UNION

keyword placed between two select statements to join the results into one table

41
New cards

equijoin

compares the columns of two tables with the = operator

42
New cards

non-equijoin

compares the columns of two tables with an operator other than =, such as < or >

43
New cards

self-join

joins a table to itself. Aliases are specified after the table name in the FROM and JOIN clauses

44
New cards

CROSS JOIN

combines two tables without comparing columns and results in all possible combinations of rows from both tables

45
New cards

subquery

nested query

inner query

a query within another SQL query, typically used in a SELECT statement’s WHERE clause to return data to the outer query and restrict the selected results

46
New cards

correlated subqueries

when a subquery’s WHERE clause references a column from the outer query. In this case, the rows selected depend on what row is currently being examined by the outer query

47
New cards

EXISTS operator

returns TRUE if a subquery selects at least one row and FALSE if no rows are selected

48
New cards

operator

returns TRUE if a subquery selects no rows and FALSE if at least one row is selected

49
New cards

flattening

when a subquery is replaced with an equivalent join. Criteria are complex and depend on the SQL implementation in each database system.

50
New cards

most subqueries that follow IN or EXISTS, or return a single value

subqueries that can be flattened

51
New cards

most subqueries that follow NOT EXISTS or contain a GROUP BY clause

subqueries that cannot be flattened

52
New cards

Retain the outer query SELECT, FROM, GROUP BY, HAVING, and ORDER BY clauses

First step for flattening a query

53
New cards

Add INNER JOIN clauses for each subquery table

Second step for flattening a query

54
New cards

Move comparisons between subquery and outer query columns to ON clauses

Third step for flattening a query

55
New cards

Add a WHERE clause with the remaining expressions in the subquery and outer query WHERE clauses

Fourth step for flattening a query

56
New cards

If necessary, remove duplicate rows with SELECT DISTINCT

Fifth step for flattening a query

57
New cards

Test the flattened query and adjust to achieve the correct result.

Final step for flattening a query

58
New cards

view table

a table name associated with a SELECT statement

59
New cards

view query

the SELECT statement associated with a specific view table

60
New cards

CREATE VIEW statement

specifies the view name, query, and optional column names for a view table

61
New cards

base table

a table specified in the view query’s FROM clause, unless it is another view table

62
New cards

materialized view

a view for which data is stored at all times. Not supported by MySQL and many other databases as it requires a lot of overhead to refresh every time a base table is changed.

63
New cards
  • Protect sensitive data

  • Save complex queries

  • Save optimized queries

Advantages of view tables

64
New cards

WITH CHECK OPTION clause

an option for CREATE VIEW statements that cause the database to reject inserts and updates that do not satisfy the view query WHERE clause

65
New cards

relational algebra

A set of nine operations that form the theoretical foundation of SQL and were first laid out by E.F. Codd in his paper on the relational model

66
New cards

compatible tables

tables with the same number of columns with the same data types

67
New cards

set operations

the collective term for union, intersect, and difference operations, which are performed on compatible tables

68
New cards

equivalent expressions

expressions that operate on the same tables and generate the same result

69
New cards

query optimizer

software similar to a programming language compiler that converts an SQL query into a sequence of low-level database actions

70
New cards

query execution plan

the sequence of low-level database actions that a query optimizer converts an SQL query into

71
New cards

cost of an operation

a numeric estimate of processing time for an operation, which usually combines both storage media access and computation time in a single measure