chapter 3 Flashcards
what are logical conditions
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
what are the logical operators
And: returns true if both conditions are true
Or: Returns true is either conditions are true
Not: Returns true if the condition is false
what is the syntax for the NOT operator
Select <column>
FROM <table name>
WHERE <column> NOT IN (1700, 1800);</column></column>
what is the order of operations in sql query
ARITHMETIC
CONCATENATION
COMPARISON (<, <=, >, >=, <>)
IS NOT NULL, LIKE, NOT IN
NOT BETWEEN
NOT
AND
OR
what does the ORDER BY clause do
sql uses the order by clause to order data
how are NULL values sorted
Null values are displayed —> last in ascending order
–> first in descending order
what does NULLS FIRST do
Specifies that NULL values should be returned before non-NULL values
What does NULLS LAST do
specifies that NULL values should be returned after non-NULL values
syntax for null last/first
ORDER BY <column_name> NULLS LAST;</column_name>
ORDER BY CLAUSE MUST BE THE ____ CLAUSE OF THE SQL STATEMENT
LAST
how to sort in descending order
ORDER BY <column_name> DESC</column_name>
what is the order of execution of a select statement
–> 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
Is there a limit to the number of columns you can supply in order by
No, there is no limit
can you reverse the sort order of a specific column out of multiple columns? if yes what is the syntax
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.
what is an argument
inputs into a function is referred to as an argument