๋ณธ๋ฌธ์œผ๋กœ ๊ฑด๋„ˆ๋›ฐ๊ธฐ

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."