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
Note that this article does not simply teach you ...
1. Problem Description When starting MYSQL, a pro...
Table of contents 1. Technology Selection 2. Tech...
Effect picture: The implementation code is as fol...
Table of contents 1. Overview 2. Name field 3. Ve...
Vertical table Vertical table splitting means spl...
In the process of team development, it is essenti...
I'm working on electronic archives recently, ...
Including the use of check boxes and radio buttons...
1. It is preferred to use the root user to log in...
1. Tools We need two tools now: MySQL server (mys...
.imgbox{ width: 1200px; height: 612px; margin-rig...
The relationship between Javascript and DOM is ve...
Separation of static and dynamic Dynamic requests...
Sometimes we need to import some data from anothe...