M6 SQL Flashcards
SQL joins, 1-row functions, and group functions (58 cards)
Which join returns all rows from the left table and matching rows from the right?
LEFT OUTER JOIN
Which join returns all rows from the right table and matching rows from the left?
RIGHT OUTER JOIN
Fill in the blank: A non-equality join uses comparison operators like <, >, BETWEEN instead of _____.
=
Which set operator combines results from two SELECTs and removes duplicates?
UNION
Which set operator combines all rows from two SELECTs including duplicates?
UNION ALL
Which set operator returns only the rows that appear in both SELECTs?
INTERSECT
Which clause is used in a traditional join method?
WHERE clause
How do you avoid Cartesian joins?
Include a proper join condition using ON or WHERE
What function extracts a portion of a string based on position?
SUBSTR
Which function returns the number of characters in a string?
LENGTH
Function that pads the right side of a string with a character?
RPAD
Function that removes a character from the left side of a string?
LTRIM
Function that removes a character from the right side of a string?
RTRIM
What function replaces single characters in a string with others?
TRANSLATE
What function joins two strings together?
CONCAT
What function converts all letters in a string to lowercase?
LOWER
What function capitalizes the first letter of each word in a string?
INITCAP
What function rounds a number to a specified decimal place?
ROUND
Function that truncates a number after a decimal place?
TRUNC
Which function returns the remainder of a division operation?
MOD
Function that returns the absolute value of a number?
ABS
What function raises one number to the power of another?
POWER
Function that adds a number of months to a date?
ADD_MONTHS