SQL column name escaping
Identifying columns in SQL statements usually requires specifying column names. However, some situations may require escaping these names, causing the following issues:
Does SQL have a standard for escaping column names?
Yes, the SQL:1999 standard specifies the use of double quotes ("") as the delimiter for identifiers (including column names).
What are the options for escaping column names in MySQL and SQLite?
Both MySQL and SQLite support the use of double quotes as column name separators. In MySQL, you can optionally enable ANSI mode for this feature to take effect.
Does this method also work with SQL Server?
Yes, SQL Server also supports escaping column names with double quotes, but you must enable the QUOTED_IDENTIFIER option for this to take effect.
The above is the detailed content of How Do I Escape Column Names in SQL?. For more information, please follow other related articles on the PHP Chinese website!