Exam 2 Outcome 4-6 Flashcards

1
Q

for table joins, the join condition is found in the ____ clause

A

WHERE

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

table joins are usually based on _____ relationships

A

primary/foreign key

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

table aliases are found in the _____ clause

A

WHERE

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

a table alias replaces the ____ with a ____ in order to simplify column identifications

A

table name; single letter (or more)

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

if a column name within the SELECT statement exists in more than one table within the FROM clause, the column bust be _____

A

further identified by table with the corresponding table alias

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

tables are improperly joined when there is ____

A

no join condition placed in the WHERE clause

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

when tables are improperly joined, a ____ is created

A

cartesian product

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

returns every row of data in one table joined to every row of data in the other tables

A

cartesian product

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

in cartesian product, the ____ returned is multiplied

A

number of rows

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

t or f. users may perform cartesian product on purpose

A

t

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

t or f. it doesn’t matter whether you list WHERE clause restrictions before or after join relationships

A

t

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

relationship between # of tables and # of join conditions

A

of tables is always 1 more than # of join conditions

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

5 types of joins

A
  1. cartesian
  2. equality
  3. self
  4. non-equality
  5. outer
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

join: useful when doing certain statistical calculations

A

cartesian join

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

another name for cartesian join

A

cross join

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

join: matches columns on the basis of equality

A

equality join

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

join: based on primary/foreign key relationships

A

equality join

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

3 other names for equality joins

A
  1. equijoin
  2. inner join
  3. simple join
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

join: data in one column of a table has a relationship with another column in the same table

A

self-join

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

in self-joins, it is necessary to link the table to itself in order to _____

A

match data

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

join: joins 2 or more tables based on a specified column value that doesn’t equal a specified column value in another table

A

non-equality joins

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

join: used to see rows that don’t meet the join condition

A

outer joins

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

outer join operator

A

(+)

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

(+) is used on the join condition in the ____ clause

A

WHERE

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

(+) can be placed on ____ of the WHERE clause but not ____

A

either side; both sides

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q
  1. outer join rule: a WHERE condition using a column from the outer join table must also include ____
A

(+) operator

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q
  1. outer join rule: a WHERE condition containing the (+) operator can’t be combined with another condition using this operator
A

OR

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q
  1. outer join rule: this logical operator is usable in place of OR
A

AND

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q
  1. outer join rule: a WHERE condition can’t use the ___ condition to compare a column marked with the (+) with an expression
A

IN comparison

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q
  1. outer join rule: a WHERE condition can’t compare any column marked with the (+) operator with a ____
A

subquery

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

another name for non-equality join

A

non-equijoin

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

join: replicates each row from the first table with every row from the second table (displays every possible record combo)

A

cartesian join

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

join: creates join by using commonly named or defined columns

A

equality join

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

join: joins a table to itself

A

self-join

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

join: joins tables when there are no equivalent rows in the tables to be joined (matches values in one column with a range of values in another)

A

non-equality join

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

join: includes records of a table in output when there’s no matching record in the other table

A

outer join

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

of alternate methods to perform equality joins

A

3

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

2 advantages of alternate equality joins

A
  1. WHERE clause is used only for row restriction conditions

2. improves script readability

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

alternate equality join that is most similar to traditional syntax

A

JOIN ON

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

alternate equality join that is rarely used due to potential for more than one column name matching between the tables

A

NATURAL JOIN

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

alternate equality join where table aliases aren’t required

A

JOIN USING

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

only possible alternate syntax for self-joins and non-equality joins

A

JOIN ON

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

disadvantage of using the outer join operator (+) on the deficient side of the join condition

A

can only be placed on one side of one side of one join condition

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

alternate outer join syntax: right table is deficient

A

LEFT OUTER JOIN

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

alternate outer join syntax: left table is deficient

A

RIGHT OUTER JOIN

46
Q

2 advantage of alternate outer join

A
  1. can be used on both sides of join condition using FULL OUTER JOIN syntax
  2. multiple tables can be joined using differrent outer joins
47
Q

disadvantage of alternate outer join

A

does not work when WHERE conditions on “deficient” table are used

48
Q

join: provides the only means to show all rows from both tables whether a join condition is met or not

A

full outer join

49
Q

cannot use _____ for full outer join

A

traditional syntax

50
Q

functions that return one row of output for each record processed

A

single row functions

51
Q

functions that return one result for each group of rows processed

A

group functions

52
Q

2 other names for group functions

A
  1. multiple-row functions

2. aggregate functions

53
Q

group function that returns the number of rows

A

COUNT

54
Q

data type: COUNT

A

any

55
Q

group function: sum of values in rows returned for a specific column

A

SUM

56
Q

data type: SUM

A

NUMBER

57
Q

group function: average value of rows returned for a specific column

A

AVG

58
Q

data type: AVG

A

NUMBER

59
Q

group function: max value from rows returned for a specific column

A

MAX

60
Q

data type: MAX

A

any

61
Q

group function: minimum value from rows returned for a specific column

A

MIN

62
Q

data type: MIN

A

any

63
Q

t or f. all group function ignore null values

A

t (one exception)

64
Q

3 ways to use COUNT

A
  1. COUNT (*)
  2. COUNT (expr)
  3. COUNT (DISTINCT expr)
65
Q

counts all rows that meet the condition including duplicates and nul values

A

COUNT (*)

66
Q

returns number of non-null values in the column specified

A

COUNT (expr)

67
Q

returns non-duplicate values in the column specified, including null values

A

DISTINCT

68
Q

determines unique values within the column specified

A

DISTINCT

69
Q

how many DISTINCTS can be used per SELECT clause?

A

only 1

70
Q

DISTINCT must be listed on the ____

A

first column/expression

71
Q

can only use DISTINCT on columns listed in the _____ for sorting

A

SELECT clause

72
Q

returns the number of non-duplicate, non-null values in the column specified

A

COUNT (DISTINCT expr)

73
Q

t or f. MAX and MIN don’t work with DATE and VARCHAR2 fields

A

f.

74
Q

MAX DATE returns ____

A

recent

75
Q

MIN DATE returns ____

A

old

76
Q

MAX VARCHAR2 returns ____

A

z

77
Q

MIN VARCHAR 2 returns ____

A

a

78
Q

since group functions ignore null values, a ____ must be employed to force calculations to include null values

A

single-row functions

79
Q

single-row function that changes the display of a null value, allowing group functions to display it

A

NVL

80
Q

when to use JOIN USING

A

equality joins

81
Q

when to use JOIN ON

A

everything else

82
Q

used when dividing summary data into groups

A

GROUP BY clause

83
Q

the column used in the GROUP BY clause doesn’t need to be included in the _____

A

SELECT clause

84
Q

____ can’t be used in the GROUP BY clause

A

column aliases

85
Q

group functions can only be nested to a depth of ___

A

2

86
Q

t or f. multiple single row functions can be applied to nested group functions

A

t

87
Q

why error: not a group by expression?

A

missing column

88
Q

why error: not a single group function?

A

check group by

89
Q

group functions can’t be executed within a _____ clause

A

WHERE

90
Q

the WHERE clause is used to restrict ____, the HAVING clause is used to restrict ____

A

rows; groups

91
Q

combines the results of two or more queries into a single result

A

set operator

92
Q

4 set operators

A
  1. UNION
  2. UNION ALL
  3. INTERSECT
  4. MINUS
93
Q

for set operators, each query must contain ____

A

the same number of columns

94
Q

for set operators, columns between the queries must have ____

A

coordinating data types

95
Q

for set operators, column names can be different between queries but the output will adopt the column names from ____

A

the first query

96
Q

for set operators, only one ____ can be instituted at the end of set operation syntax

A

ORDER BY

97
Q

for set operators, ____ results can’t be ordered separately

A

individual query

98
Q

for set operators, ____ can’t be used

A

column aliases

99
Q

t or f. set operators can be used in subqueries

A

t

100
Q

set operators: returns results of both queries but removes duplicate records

A

UNION

101
Q

set operators: similar to DISTINCT

A

UNION

102
Q

set operators: returns results of both queries; includes duplicate records

A

UNION ALL

103
Q

DISTINCT set operator

A

UNION

104
Q

includes duplicates set operator

A

UNION ALL

105
Q

set operators: returns only results appearing in both queries

A

INTERSECT

106
Q

set operators: subtracts the second query’s results if they are also returned in the first query’s results

A

MINUS

107
Q

set operators: opposite of intersect; does not show intersecting results

A

MINUS

108
Q

a view is a ____ just like tables, sequences

A

database object

109
Q

although views are database objects, they don’t actually store data – they store ____ to access data in underlying tables

A

a query

110
Q

3-step view process:

A
  1. create view based on data in table(s)
  2. query the view instead of the table(s)
  3. the query stored in the view is executed
111
Q

4 purposes of views

A
  1. Simplify issuing complex SQL queries
  2. Restrict users’ access to sensitive data
  3. Perform calculations on columns
  4. Portray data in different ways
112
Q

t or f. if you use a column alias, for views, you cannot use the regular column name in a query

A

t