chapter 3 Flashcards

1
Q

what are logical conditions

A

Logical conditions combine thee result of two component conditions to produce a single result based on them

A result if returned only if the overall result of the condition is true

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

what are the logical operators

A

And: returns true if both conditions are true

Or: Returns true is either conditions are true

Not: Returns true if the condition is false

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

what is the syntax for the NOT operator

A

Select <column>
FROM <table name>
WHERE <column> NOT IN (1700, 1800);</column></column>

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

what is the order of operations in sql query

A

ARITHMETIC

CONCATENATION

COMPARISON (<, <=, >, >=, <>)

IS NOT NULL, LIKE, NOT IN

NOT BETWEEN

NOT

AND

OR

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

what does the ORDER BY clause do

A

sql uses the order by clause to order data

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

how are NULL values sorted

A

Null values are displayed —> last in ascending order
–> first in descending order

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

what does NULLS FIRST do

A

Specifies that NULL values should be returned before non-NULL values

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

What does NULLS LAST do

A

specifies that NULL values should be returned after non-NULL values

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

syntax for null last/first

A

ORDER BY <column_name> NULLS LAST;</column_name>

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

ORDER BY CLAUSE MUST BE THE ____ CLAUSE OF THE SQL STATEMENT

A

LAST

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

how to sort in descending order

A

ORDER BY <column_name> DESC</column_name>

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

what is the order of execution of a select statement

A

–> From clause: locates teh table that contains the data

–> Where clause: restricts the rows to be returned

–> Select clause: selects from the reduced data set the columns requested

–> Order by: orders the result set

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

Is there a limit to the number of columns you can supply in order by

A

No, there is no limit

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

can you reverse the sort order of a specific column out of multiple columns? if yes what is the syntax

A

ORDER BY department_id DESC, last_name

The ORDER BY for the department_id has been reversed (from the previous slide) using DESC, so are now
shown from highest to lowest, the order of last name is still alphabetical, A to Z.

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

what is an argument

A

inputs into a function is referred to as an argument

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

what are the 2 types of functions

A

single row
multiple row

17
Q

what are single row functions

A

–> operate on single rows only and return one result per row

–> There are different types of single row functions including character, number, date and conversion functions

18
Q

can single row functions be nested

A

Yes

19
Q

What are single row functions used for

A

–> perform calculations such as rounding numbers to a specified decimal place

–> accept one or more arguments

–> Modify individual data items such as converting character values from uppercase to lowercase

20
Q

What are multiple row functions

A

–> These functions can manipulate groups of rows to give one result per group of rows

–> These functions are also known as group functions`

21
Q

can the row inputs for multiple row functions include the entire table

A

yes