Fundamentals Flashcards

1
Q

What is the function of the SELECT keyword?

A

The SELECT keyword is used to query data from tables

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

List three possible SELECT selector types.

A
  1. * selects all columns
  2. A list of column names, separated by a ,
  3. Expressions & literal values
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How would you concatenate and return the values of two or more columns?

A

Split column names with the concatenation operator || (double pipe).

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

In which order does a basic SELECT statement evaluate?

A

The FROM value is evaluated before the SELECT value.

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

When should you omit FROM from a select statement? Provide an example.

A

FROM can be omitted when no data is being queried from a table.

An example of this is when SELECT is used to evaluate a mathematical expression, i.e.: SELECT 5 * 3 returns an unnamed column with a single row value of 15.

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

What is the function of the DISTINCT clause?

A

The DISTINCT clause selects distinct rows.

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

What is the function of the ORDER BY clause?

A

The ORDER BY clause sorts selected rows.

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

What is the function of the WHERE clause?

A

The WHERE clause filters selected rows.

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

What is the function of the LIMIT and FETCH clauses?

A

The LIMIT and FETCH clauses select a subset of rows.

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

What is the function of the GROUP BY clause?

A

The GROUP BY clause groups rows by a given value.

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

What is the function of the HAVING clause?

A

The HAVING clause filters grouped rows.

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

What is the function of INNER JOIN, LEFT JOIN, FULL OUTER JOIN, and CROSS JOIN?

A

INNER JOIN, LEFT JOIN, FULL OUTER JOIN, and CROSS JOIN connect tables together.

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

What are the UNION, INTERSECT, and EXCEPT clauses?

A

The UNION, INTERSECT, and EXCEPT clauses are set operations.

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

What is the function of column aliases?

A

Column aliases assign temporary name to columns in queries.

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

What is the lifespan of column aliases?

A

Column aliases exist during the execution of the query.

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

What keyword is used to denote a column alias? What can be used instead of the keyword?

A

The keyword used to denote a column alias is AS. It can be omitted for a space between the selector and the alias.

17
Q

With what types of selectors can aliases be used?

A

Aliases can be used with all types of selectors, including expressions.

18
Q

How would you format aliases that contain spaces?

A

Aliases with spaces should be wrapped in double quotes.