1.6 Selecting Rows Flashcards
operator / operands
An operator is a symbol that computes a value from one or more other values, called operands: Arithmetic operators compute numeric values from numeric operands. Comparison operators compute logical values TRUE or FALSE. Operands may be numeric, character, and other data types. Logical operators compute logical values from logical operands.
unary operator
A unary operator has one operand.
ex: logical operator NOT
binary operator
A binary operator has two operands.
expression
An expression is a string of operators, operands, and parentheses that evaluates to a single value. Operands may be column names or fixed values. The value of an expression may be any data type.
operator precedence
Operators in an expression are evaluated in the order of operator precedence, shown in the table below. Operators of the same precedence are evaluated from left to right. Regardless of operator precedence, expressions enclosed in parentheses are evaluated before any operators outside the parentheses are applied.
SELECT / FROM
The SELECT statement selects rows from a table. The statement has a SELECT clause and a FROM clause. The FROM clause specifies the table from which rows are selected. The SELECT clause specifies one or more expressions, separated by commas, that determine what values are returned for each row.
result table
The SELECT statement returns a set of rows, called the result table.
LIMIT
MySQL has a LIMIT clause that limits the number of rows returned by a SELECT statement.
condition
A condition is an expression that evaluates to a logical value.
WHERE
A SELECT statement has an optional WHERE clause that specifies a condition for selecting rows. A row is selected when the condition is TRUE for the row values. A row is omitted when the condition is either FALSE or NULL.
Arithmetic operators
+ - * / % ^
compute numeric values from numeric operands.
Comparison operators
= != <> < <= > >=
compute logical values and returns TRUE or FALSE.
Logical operators
AND OR NOT
compute logical values from logical operands.