Skip to main content
Documents
Share
LinkedIn
Facebook
Twitter
Copy
ClausesStatementsKeywordsExpressionsFunctions

Keywords

MySQL keywords are predefined reserved words that form the syntax and logic of SQL commands. They control the behavior of the database and should not be used as identifiers.

Common Uses of MySQL Keywords

  1. SELECT: Fetches data.
  2. FROM: Specifies the table.
  3. WHERE: Filters results.
  4. AND/OR: Combines conditions.
  5. DISTINCT: Ensures unique results.

Examples

  1. SELECT and FROM Keywords
     
    SELECT name FROM employees;

    Explanation: Fetches the name column from the employees table.

  2. WHERE Keyword
     
    SELECT * FROM orders WHERE amount > 100;

    Explanation: Filters orders where amount exceeds 100.

  3. AND/OR Keywords
     
    SELECT * FROM users WHERE age > 18 AND active = 1;

    Explanation: Filters users older than 18 and currently active.

  4. DISTINCT Keyword
     
    SELECT DISTINCT department FROM employees;

    Explanation: Retrieves unique department names from the employees table.

  5. LIKE Keyword
     
    SELECT * FROM customers WHERE name LIKE 'J%';

    Explanation: Fetches customers whose names start with "J."