Complex Queries Flashcards

1
Q

IN

A

Operator is used in a WHERE clause to determine if a value matches one of several values

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

BETWEEN

A

Operator provides an alternative way to determine if a value is between two other values.

Written as value BETWEEN minValue AND maxValue and is equivalent to valu

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

LIKE

A

Operator when used in a WHERE clause, matches text against a pattern using the two wildcard characters % and __.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

BINARY

A

Like operator performs case-insensitive pattern matching by default or case-sensitive pattern matching if followed by the BINARY keyword

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

DISTINCT

A

used with a SELECT statement to return only unique or ‘distinct’ values

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

ORDER BY

A

Clause orders selected rows by one or more columns in ascending (alphabetic or increasing order)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

DESC

A

When used with ORDER BY orders rows in descending order.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Function/Argument

A

Operates on an expression enclosed in parentheses, called an argument, and returns a value.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Aggregate function

A

processes values from a set of rows and returns a summary value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

COUNT()

A

Counts the numbers of rows in the set

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

MIN()

A

Finds the minimum value in the set

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

MAX()

A

Finds the maximum value in the set

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

SUM()

A

sums all the values in the set

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

AVG

A

Computes the arithmetic mean of all the values in the set

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

GROUP BY

A

Each simple or composite value of the columns becomes a group. Query computes the aggregate function separately, and reutns one row, for each group

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

HAVING

A

used with the GROUP BY clause to filter group results

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

JOIN

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

AS

A

Simplify queries or result tables, a column name can be replaced with an Alias. The alias follows the column name, separated by an optional AS keyword.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Join clause

A

Determines how a join query handles unmatched rows

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

INNER JOIN

A

selects only matching left and right table rows

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

FULL JOIN

A

selects all left and right table rows, regardless of match

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

On

A

Specifies the join columns.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

LEFT JOIN

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

RIGHT JOIN

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

OUTER JOIN

A

Any join that selects unmatched rows, including left, right and full joins

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

UNION

A

Combines the two results into one table

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

Equijoin

A

Compares columns of two tables with the = Operator

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

non-equijoin

A

Compares the colums with an operator other than =, such as < and >

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

Self-Join

A

Joins a table to itself

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

Cross-Join

A

Combines two tables without comparing columns

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

CROSS JOIN

A

The actual cluase for a cross join command

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

Subquery/Nested Query/Inner Query

A

Query within another SQL query

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

Correlated

A

When the subquery’s WHERE clause references a column from the outer query

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

Alias

A

Temporary name assigned to a column or table

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q

AS

A

Keyword follows a column or table name to create an alias

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
36
Q

EXISTS

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
37
Q

NOT EXISTS

A

True if a subquery selects no rows, and FALSE if at least one row is selected

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
38
Q

Flattening

A

Replacing a subquery with an equivalent join is called flattening a query

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
39
Q

View Table/View Query

A

table name associated with a SELECT statement, called the view query

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
40
Q

CREATE VIEW

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
41
Q

base table

A

Specified in the views query’s FROM clause is called a base table.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
42
Q

materialized view

A

View for which data is stored at all times

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
43
Q

WITH CHECK OPTION

A

Database rejects inserts and updates that do not satisfy the view query WHERE Clause

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
44
Q

Select Operation

A

Operation that selects table rows based on a logical expression

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
45
Q

Project Operation

A

Operation selects table columns

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
46
Q

Product operation

A

Combines two tables into one result. The result includes all columns and all combination of rows from both tables

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
47
Q

join

A

denoted with a bowtie symbol is identical to a product followed by a select

48
Q

Theta Join

A

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

49
Q

Compatible tables

A

Same number of columns with the same data types. Column names may be different

50
Q

Set Operations

A

Union, intersect, and difference operate on compatible tables, and collectively, are called set operations

51
Q

Union

A

operation combines all rows of two compatible tables into a single table. Duplicate rows are excluded from the result table

52
Q

Intersect

A

Operates on two compatible tables and returns only rows that appear in both tables

53
Q

Difference

A

Operation removes from a table all rows that appear in a second compatible table

54
Q

Rename Operation

A

specifies a new table and column names

55
Q

Aggregate operation

A

Applies aggregate functions like SUM(),AVG(),MIN, and MAX().

56
Q

Equivalent

A

Relational algebra expression are equivalent if the expression operate on the same tables and generate the same result

57
Q

query Optimizer/QUery execution Plan

A

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

58
Q

Cost

A

operation is a numeric estimate of processing time. The cost estimate usually combines both storage media access and computation time in a single measure

59
Q

Operator is used in a WHERE clause to determine if a value matches one of several values

A

IN

60
Q

Operator provides an alternative way to determine if a value is between two other values.

Written as value BETWEEN minValue AND maxValue and is equivalent to valu

A

BETWEEN

61
Q

Operator when used in a WHERE clause, matches text against a pattern using the two wildcard characters % and __.

A

LIKE

62
Q

Like operator performs case-insensitive pattern matching by default or case-sensitive pattern matching if followed by the BINARY keyword

A

BINARY

63
Q

used with a SELECT statement to return only unique or ‘distinct’ values

A

DISTINCT

64
Q

Clause orders selected rows by one or more columns in ascending (alphabetic or increasing order)

A

ORDER BY

65
Q

When used with ORDER BY orders rows in descending order.

A

DESC

66
Q

Operates on an expression enclosed in parentheses, called an argument, and returns a value.

A

Function/Argument

67
Q

processes values from a set of rows and returns a summary value

A

Aggregate function

68
Q

Counts the numbers of rows in the set

A

COUNT()

69
Q

Finds the minimum value in the set

A

MIN()

70
Q

Finds the maximum value in the set

A

MAX()

71
Q

sums all the values in the set

A

SUM()

72
Q

Computes the arithmetic mean of all the values in the set

A

AVG

73
Q

Each simple or composite value of the columns becomes a group. Query computes the aggregate function separately, and reutns one row, for each group

A

GROUP BY

74
Q

used with the GROUP BY clause to filter group results

A

HAVING

75
Q

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

A

JOIN

76
Q

Simplify queries or result tables, a column name can be replaced with an Alias. The alias follows the column name, separated by an optional AS keyword.

A

AS

77
Q

Determines how a join query handles unmatched rows

A

Join clause

78
Q

selects only matching left and right table rows

A

INNER JOIN

79
Q

selects all left and right table rows, regardless of match

A

FULL JOIN

80
Q

Specifies the join columns.

A

On

81
Q

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

A

LEFT JOIN

82
Q

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

A

RIGHT JOIN

83
Q

Any join that selects unmatched rows, including left, right and full joins

A

OUTER JOIN

84
Q

Combines the two results into one table

A

UNION

85
Q

Compares columns of two tables with the = Operator

A

Equijoin

86
Q

Compares the colums with an operator other than =, such as < and >

A

non-equijoin

87
Q

Joins a table to itself

A

Self-Join

88
Q

Combines two tables without comparing columns

A

Cross-Join

89
Q

The actual cluase for a cross join command

A

CROSS JOIN

90
Q

Query within another SQL query

A

Subquery/Nested Query/Inner Query

91
Q

When the subquery’s WHERE clause references a column from the outer query

A

Correlated

92
Q

Temporary name assigned to a column or table

A

Alias

93
Q

Keyword follows a column or table name to create an alias

A

AS

94
Q

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

A

EXISTS

95
Q

True if a subquery selects no rows, and FALSE if at least one row is selected

A

NOT EXISTS

96
Q

Replacing a subquery with an equivalent join is called flattening a query

A

Flattening

97
Q

table name associated with a SELECT statement, called the view query

A

View Table/View Query

98
Q

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

A

CREATE VIEW

99
Q

Specified in the views query’s FROM clause is called a base table.

A

base table

100
Q

View for which data is stored at all times

A

materialized view

101
Q

Database rejects inserts and updates that do not satisfy the view query WHERE Clause

A

WITH CHECK OPTION

102
Q

Operation that selects table rows based on a logical expression

A

Select Operation

103
Q

Operation selects table columns

A

Project Operation

104
Q

Combines two tables into one result. The result includes all columns and all combination of rows from both tables

A

Product operation

105
Q

denoted with a bowtie symbol is identical to a product followed by a select

A

join

106
Q

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

A

Theta Join

107
Q

Same number of columns with the same data types. Column names may be different

A

Compatible tables

108
Q

Union, intersect, and difference operate on compatible tables, and collectively, are called set operations

A

Set Operations

109
Q

operation combines all rows of two compatible tables into a single table. Duplicate rows are excluded from the result table

A

Union

110
Q

Operates on two compatible tables and returns only rows that appear in both tables

A

Intersect

111
Q

Operation removes from a table all rows that appear in a second compatible table

A

Difference

112
Q

specifies a new table and column names

A

Rename Operation

113
Q

Applies aggregate functions like SUM(),AVG(),MIN, and MAX().

A

Aggregate operation

114
Q

Relational algebra expression are equivalent if the expression operate on the same tables and generate the same result

A

Equivalent

115
Q

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

A

query Optimizer/QUery execution Plan

116
Q

operation is a numeric estimate of processing time. The cost estimate usually combines both storage media access and computation time in a single measure

A

Cost