SQL - When to Use Single or Double Quotes in Queries
If you find this SQL tutorial useful please LIKE and SUBSCRIBE! What's the difference between single and double quotes in SQL? When should you use one or the other, and does it actually make a difference? While I mostly cover SQL Server in this one, I also briefly mention MySQL and MariaDB. 00:00 - Introduction 00:06 - Single quotes 00:24 - Escaping single quotes 00:37 - Double quotes (SQL Server) 01:42 - Square brackets (SQL Server) 02:36 - Quotes in MySQL and MariaDB 03:24 - Summary tldw; Always use single quotes to enclose strings. Some relational databases allow you to enclose entity names (tables, columns) with double quotes. To do this in SQL Server you need to first run the command SET QUOTED_IDENTIFIER ON. MySQL/MariaDB is less fussy and single and double quotes can be used interchangeably. Also in SQL Server you can enclose entity names in square brackets - this is useful if your database column names have spaces in them. If you found this video leave a LIKE and SUBSCRIBE for more coding videos. Single or double quotes? Good discussion here: https://stackoverflow.com/questions/1992314/what-is-the-difference-between-single-and-double-quotes-in-sql SQL Server SET QUOTED_IDENTIFIER command reference: https://docs.microsoft.com/en-us/sql/t-sql/statements/set-quoted-identifier-transact-sql Thumbnail photo credit: https://unsplash.com/@suanmoo
Download
0 formatsNo download links available.