mysql>
CREATE TABLE t (b BIT(8));
mysql>
INSERT INTO t SET b = b'11111111';
mysql>
INSERT INTO t SET b = b'1010';
mysql>
INSERT INTO t SET b = b'0101';
Bit values are returned as binary values. To display them in printable form, add 0 or use a conversion
function such as
mysql>
SELECT b+0, BIN(b+0), OCT(b+0), HEX(b+0) FROM t;
+------+----------+----------+----------+
| b+0
| BIN(b+0) | OCT(b+0) | HEX(b+0) |
+------+----------+----------+----------+
|
255 | 11111111 | 377
|
10 | 1010
|
5 | 101
+------+----------+----------+----------+
Bit values assigned to user variables are treated as binary strings. To assign a bit value as a number to
a user variable, use
mysql>
SET @v1 = 0b1000001;
mysql>
SET @v2 = CAST(0b1000001 AS UNSIGNED), @v3 = 0b1000001+0;
mysql>
SELECT @v1, @v2, @v3;
+------+------+------+
| @v1
| @v2
+------+------+------+
| A
|
65 |
+------+------+------+
9.1.7.
Values
NULL
The
value means "no data."
NULL
sensitive).
For text file import or export operations performed with
OUTFILE,
NULL
Syntax".
Be aware that the
for string types. For more information, see
9.2. Schema Object Names
Certain objects within MySQL, including database, table, index, column, alias, view, stored procedure,
partition, and other object names are known as identifiers. This section describes the permissible
syntax for identifiers in MySQL.
identifiers are case sensitive and under what conditions.
An identifier may be quoted or unquoted. If an identifier contains special characters or is a reserved
word, you must quote it whenever you refer to it. (Exception: A reserved word that follows a period
in a qualified name must be an identifier, so it need not be quoted.) Reserved words are listed at
Section 9.3, "Reserved
Identifiers are converted to Unicode internally. They may contain these characters:
• Permitted characters in unquoted identifiers:
• ASCII: [0-9,a-z,A-Z$_] (basic Latin letters, digits 0-9, dollar, underscore)
• Extended: U+0080 .. U+FFFF
• Permitted characters in quoted identifiers include the full Unicode Basic Multilingual Plane (BMP),
except U+0000:
[886]. High-order 0 bits are not displayed in the converted value.
BIN()
| FF
| 12
| A
| 5
| 5
[948]
or +0:
CAST()
| @v3
|
65 |
NULL
is represented by the
value is different from values such as
NULL
Section 9.2.2, "Identifier Case
Words".
Values
NULL
|
|
|
can be written in any lettercase. A synonym is
LOAD DATA INFILE
sequence. See
Section 13.2.6,
\N
Section C.5.5.3, "Problems with
751
or
SELECT ... INTO
"LOAD DATA INFILE
for numeric types or the empty string
0
Values".
NULL
Sensitivity", describes which types of
(case
\N
Need help?
Do you have a question about the 5.0 and is the answer not in the manual?
Questions and answers