bitsCN.com
MySQL的转义字符“/”
mfc_basic
MySQL识别下列转义字符:
/0
一个ASCII 0 (NUL)字符。
/n
一个新行符。
/t
一个定位符。 制符分隔
/r
一个回车符。
/b
一个退格符。
/'
一个单引号(“'”)符。
/"
一个双引号(“"”)符。
一个反斜线(“/”)符。
/%
一个“%”符。它用于在正文中搜索“%”的文字实例,否则这里“%”将解释为一个通配符。
/_
一个“_”符。它用于在正文中搜索“_”的文字实例,否则这里“_”将解释为一个通配符。
注意,如果你在某些正文环境中使用“/%”或“/%_”,这些将返回字符串“/%”和“/_”而不是“%”和“_”。
★★
有几种方法在一个字符串内包括引号:
1、必须转义的:
一个字符串用单引号“'”来引用的,该字符串中的单引号“'”字符可以用“''”方式转义。
一个字符串用双引号“"”来引用的,该字符串中的“"”字符可以用“""”方式转义。
同时你也可以继续使用一个转义字符“/”来转义
2、可不转义的:
一个字符串用双引号“"”来引用的,该字符串中的单引号“'”不需要特殊对待而且不必被重复或转义。
同理,
一个字符串用单引号“'”来引用的,该字符串中的双引号“"”不需要特殊对待而且不必被重复或转义。
下面显示的SELECT演示引号和转义如何工作:
mysql> SELECT 'hello', '"hello"', '""hello""', 'hel''lo', '/'hello';
+-------+---------+-----------+--------+--------+
¦ hello ¦ "hello" ¦ ""hello"" ¦ hel'lo ¦ 'hello ¦
+-------+---------+-----------+--------+--------+
mysql> SELECT "hello", "'hello'", "''hello''", "hel""lo", "/"hello";
+-------+---------+-----------+--------+--------+
¦ hello ¦ 'hello' ¦ ''hello'' ¦ hel"lo ¦ "hello ¦
+-------+---------+-----------+--------+--------+
mysql> SELECT "This/nIs/nFour/nlines";
+--------------------+
¦ This
Is
Four
lines ¦
+--------------------+
★★
如果你想要把二进制数据插入到一个BLOB列,下列字符必须由转义序列表示:
NUL
ASCII 0。你应该用'/0'(一个反斜线和一个ASCII '0')表示它。
ASCII 92,反斜线。用'//'表示。
'
ASCII 39,单引号。用“/'”表示。
"
ASCII 34,双引号。用“/"”表示。bitsCN.com

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

Article discusses strategies for handling large datasets in MySQL, including partitioning, sharding, indexing, and query optimization.

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

The article discusses dropping tables in MySQL using the DROP TABLE statement, emphasizing precautions and risks. It highlights that the action is irreversible without backups, detailing recovery methods and potential production environment hazards.

Article discusses using foreign keys to represent relationships in databases, focusing on best practices, data integrity, and common pitfalls to avoid.

The article discusses creating indexes on JSON columns in various databases like PostgreSQL, MySQL, and MongoDB to enhance query performance. It explains the syntax and benefits of indexing specific JSON paths, and lists supported database systems.

Article discusses securing MySQL against SQL injection and brute-force attacks using prepared statements, input validation, and strong password policies.(159 characters)


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Dreamweaver CS6
Visual web development tools

WebStorm Mac version
Useful JavaScript development tools

Zend Studio 13.0.1
Powerful PHP integrated development environment

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.