+ 1

SQL DATA

While I was taking the lessons, I got a doubt Here it is: " Why are only single quotes are used why not double quotes like Python? "

6th Jul 2024, 2:29 PM
Dikshit Verma
Dikshit Verma - avatar
7 Respuestas
6th Jul 2024, 2:59 PM
R🍁🇮🇳
R🍁🇮🇳 - avatar
+ 4
It all depends on context. * Single quotes are commonly used to denote string and date/datetime literals 'This is a string' -- a string '2024-07-06' -- date '2024-07-06 14:35:41' -- datetime * Double quotes are not as common, but it is said they are used to refer table or column names. From what I read; only PostgreSQL implements the use case, not all DBMS supports it for similar functionality. It is more common to see backticks used to wrap table/column names in MySQL and MariaDB. I no longer recall whether double quotes were used in MSSQL, latest updates may differ. * Backticks are commonly used to refer table/column name, or where use of a reserved word as table/column name was considered (it is rather discouraged) SELECT `id`, `user_name`, `password` FROM `users`; cmiiw :)
6th Jul 2024, 3:21 PM
Ipang
+ 3
The short reason is that Python and SQL are different languages, and there are differences in their syntax, including how they represent strings. SQL allows single quotes only.
6th Jul 2024, 6:56 PM
Tibor Santa
Tibor Santa - avatar
0
Hi
7th Jul 2024, 2:29 PM
Gopal Rathod
Gopal Rathod - avatar
0
Tibor Santa, finally, a correct answer. Dikshit Verma, by the way, in python single quotes are only usually used for quoting quotes Ex: print(‘“what?” He said’). Hope that answered your question Cheers
8th Jul 2024, 12:13 PM
[Astro E] 王李
[Astro E] 王李 - avatar
0
Can anyone here be my boss I need to learn this
8th Jul 2024, 12:44 PM
Vardo
0
Vardo you need to learn sql or python
8th Jul 2024, 12:59 PM
[Astro E] 王李
[Astro E] 王李 - avatar