Chapter 3 Flashcards

1
Q

CRUD

A

Create, Read, Update, Delete

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

Inner Join

A

The inner join connects rows in different tables together based on a condition known as the join predicate. The join predicate is a logical condition of equality. Each row in the first table is compared against every other row in the second table. For row combinations that meet the inner join predicate, that row is returned in the query. Otherwise, the row combination is discarded.

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

Left Outer Join (Left Join)

A

Left outer joins are where the left table (that is, the table mentioned first in a join clause) will have every row returned. If a row from the other table is not found, a row of NULL is returned. Left outer joins are performed by using the LEFT OUTER JOIN keywords followed by a join predicate. This can also be written in short as LEFT JOIN.

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

Right Outer Join (Right Join)

A

A right outer join is very similar to a left join, except the table on the “right” (the second listed table) will now have every row show up, and the “left” table will have NULLs if the join condition is not met.

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

FULL OUTER JOIN

A

Finally, there is the full outer join. The full outer join will return all rows from the left and right tables, regardless of whether the join predicate is matched. For rows where the join predicate is met, the two rows are combined in a group. For rows where they are not met, the row has NULL filled in. The full outer join is invoked by using the FULL OUTER JOIN clause, followed by a join predicate.

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

CROSS JOIN

A

The cross join is mathematically what is also referred to as the Cartesian product – it returns every possible combination of rows from the “left” table and the “right” table. It can be invoked using a CROSS JOIN clause, followed by the name of the other table.

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

UNION

A

Putting multiple queries together vertically; that is, by keeping the same number of columns but adding multiple rows

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

CASE WHEN

A

A function that allows a query to map various values in a column to other values. CASE WHEN, WHEN, ELSE

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

COALESCE

A

Useful technique is to replace NULL values with a standard value

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

NULLIF

A

Opposite of COALESCE. A two-value function and will return NULL if the first value equals the second value…

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

LEAST/GREATEST

A

Each function takes any number of values and returns the least or the greatest of the values, respectively.

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

Casting (column::datatype - what you want to change the column to)

A

Another useful data transformation is to change the data type of a column within a query. This is usually done to use a function only available to one data type, such as text, while working with a column that is in a different data type, such as a numeric.

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

DISTINCT

A

Determines the unique values in a column or group of columns

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

DISTINCT ON -

A

Allows you to ensure that only one row is returned where one or more columns are always unique in the set.

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