PrefaceSo I wrote this blog. This blog also recommends some knowledge from articles by big guys. If there is any infringement, please contact me! If someone is lucky enough to see this blog, I hope it can be helpful to you. If there are any mistakes, you can point them out directly! ! 1. Single quotes:Let's first introduce single quotes. The word '男' in the picture below is the English single quote. Why use single quotes? In SQL, some varchar (string, and other string types) need to use single quotes instead of using them directly. Generally, in the database, numeric types do not need to be enclosed in single quotes. Let's look at the example below: The above mentioned that in general, quotation marks are not needed. However, if in different visual database tools, some of them can be queried with quotation marks and no errors will be reported. However, we still need to write them with correct SQL statements to avoid bugs in the future. 2. Backticks:It is a symbol introduced to distinguish MYSQL reserved words from ordinary characters. We can see the example below: This is a normal query. What if we put quotation marks around gender? What will happen in this case? This is incorrect in SQL syntax, but some database visualization tools do not report an error, but we cannot query any values. Let’s add it and see what happens if we add backquotes. This will result in the same situation as the first one. This is used to distinguish the difference between the two. Otherwise, the database tool will think they are all strings and the search will not be successful! ! Note the following: MySQL reserved words must be distinguished by backticks! ! ! The so-called reserved words are SQL instructions for databases such as select database insert. When we have to use them as table names and field names, we must add backticks to prevent the compiler from considering this part as a reserved word and generating an error. You may also be interested in:
|
<<: Uniapp implements DingTalk scan code login sample code
>>: CSS achieves highly adaptive full screen
Table of contents 1. Isolation Level READ UNCOMMI...
Preface In the process of developing a mini progr...
The questions encountered in Baidu interviews nee...
Follow the official tutorial, download the instal...
Table of contents 1. charAt grammar parameter ind...
= Only when setting and updating does it have the...
1. The mysqldump backup method uses logical backu...
Preface Intel's hyper-threading technology al...
Controversy over nofollow There was a dispute bet...
Vulnerability Details VSFTP is a set of FTP serve...
1. Avoid declaring the page as XML type . The pag...
Table of contents Preface 1. Optimistic Locking A...
This article example shares the specific code of ...
Table of contents compose function Array.prototyp...
TeamCenter12 enters the account password and clic...