W3. SQL Operators Flashcards
Q: List the basic SQL arithmetic operators.
A: + (Add), - (Subtract), * (Multiply), / (Divide), % (Modulo)
Q: What does the % (Modulo) arithmetic operator do in SQL?
A: It returns the remainder after dividing two numbers.
Q: List some SQL bitwise operators.
A: & (Bitwise AND), | (Bitwise OR), ^ (Bitwise exclusive OR)
Q: What is the function of the & (Bitwise AND) operator?
A: It performs a bitwise AND operation between two values.
Q: List the main SQL comparison operators.
A: = (Equal to), > (Greater than), < (Less than), >= (Greater than or equal to), <= (Less than or equal to), <> (Not equal to)
Q: What does the <> operator do in SQL?
A: It checks if two values are not equal to each other.
Q: List some SQL compound operators.
A: +=, -=, *=, /=, %= (arithmetic compound operators), &=, ^=, |= (bitwise compound operators)
Q: What does the += compound operator do?
A: It adds a specified value to the original value and updates the original value.
Q: List the SQL logical operators.
ALL, AND, ANY, BETWEEN, EXISTS, IN, LIKE, NOT, OR, SOME
Q: What does the AND logical operator do?
A: It returns TRUE if all conditions separated by AND are TRUE.
Q: Describe the EXISTS logical operator.
A: It returns TRUE if the subquery returns one or more records.
Q: How does the BETWEEN logical operator work?
A: It returns TRUE if a value is within a specified range.
Q: What does the LIKE logical operator do?
A: It returns TRUE if a value matches a specified pattern.
Q: How does the OR logical operator work in SQL?
A: It returns TRUE if any of the conditions separated by OR is TRUE.