2.6f

Operators and Operands

  • Operands: The values upon which operators perform calculations. Can be numeric, character, or other data types.

  • Operators: Symbols that specify the type of calculation to be performed.

    • Arithmetic Operators: Compute numeric values from numeric operands.

    • Logical Operators: Compute logical values from logical operands.

      • Unary Operator: Operates on one operand (e.g., NOT).

      • Binary Operator: Operates on two operands; most operators are binary.

      • NULL Behavior: Operators may return NULL when either operand is NULL.

Expression Evaluation

  • An expression computes a single value based on operators and operands.

  • Operator Precedence: Refers to the order in which operators in an expression are evaluated.

  • Expressions may also evaluate to NULL, indicating an unassigned value.

    • Example: For instance, evaluating columns such as 'Platinum' AND 'Quality Unit Price' may involve numeric values and result in NULL if conditions aren't met.

SELECT Statement Structure

  • SELECT Clause: Specifies the columns to retrieve from a data source.

    • Example: SELECT column_name, ... retrieves the specified columns.

  • FROM Clause: Indicates the table from which to select rows.

    • Example: FROM table_name specifies the source table.

  • Limit Clause: Can restrict the number of rows returned.

    • Example: LIMIT 100 indicates that only 100 rows should be returned.

WHERE Clause Evaluation

  • WHERE Clause: Optional clause that specifies conditions for row selection.

    • A row is included if the WHERE condition evaluates to TRUE for the row's values.

    • A row is omitted if the condition evaluates to FALSE or NULL, effectively filtering the results based on specified criteria.

robot