Mysql Literal(文字)

字符串

单引号,双引号都可以表示字符
sql 'a string' "another string"

转义字符

Escape Sequence Character Represented by Sequence
\0 An ASCII NUL (X’00’) character
A single quote (’) character
" A double quote (") character
\b A backspace character
\n A newline (linefeed) character
\r A carriage return character
\t A tab character
\Z ASCII 26 (Control+Z); see note following the table
\ A backslash () character
% A % character; see note following the table
_ A _ character; see note following the table

例子

SELECT 'hello', '"hello"', '""hello""', 'hel''lo', '\'hello'; 语句中包含引号
SELECT "hello", "'hello'", "''hello''", "hel""lo", "\"hello"; 语句中包含引号
SELECT 'This\nIs\nFour\nLines';

数字

时间

十六进制

二进制

布尔

null

参考:
https://dev.mysql.com/doc/refman/8.0/en/literals.html

你可能感兴趣的:(mysql)