QUOTE()
QUOTE() is a SQL function in the String Functions category. Quotes a string safely for SQL, escaping special characters and adding surrounding quotes. MySQL-specific. The syntax is QUOTE(string). It accepts string. It returns quoted string. A typical example: SELECT QUOTE("O'Brien"); -- 'O\'Brien' -- Safe for dynamic SQL generation A close relative is CONCAT(), which concatenates two or more strings into one string. Returns NULL if any argument is NULL. A close relative is SUBSTRING(), which extracts characters from a string starting at position `start` for `length` characters. A close relative is REPLACE(), which replaces all occurrences of `from_string` with `to_string` in a string. More about this category: String manipulation — CONCAT, SUBSTRING, REPLACE, TRIM, UPPER, LOWER, LENGTH. Related String Functions entries: CONCAT(), SUBSTRING(), REPLACE(), LENGTH(), TRIM(), UPPER(), LOWER(), LPAD() / RPAD(). This page is part of the free SQL Reference documentation covering 762+ statements, functions, and clauses, each with syntax, parameters, return values, and examples for MySQL, PostgreSQL, SQL Server, and SQLite.