如何在MySQL中显示bit(1)字段?
让我们首先创建一个表。在这里,我们的列的类型为bit(1)-
mysql> create table DemoTable ( isCaptured bit(1) );
使用插入命令在表中插入一些记录-
mysql> insert into DemoTable values(0); mysql> insert into DemoTable values(1); mysql> insert into DemoTable values(0); mysql> insert into DemoTable values(1);
以下是使用select语句显示表中所有记录的查询-
mysql> select *from DemoTable;
这将产生以下输出-
+------------+ | isCaptured | +------------+ | | | | | | | | +------------+ 4 rows in set (0.00 sec)
这是查询以查看MySQL中的bit(1)字段以显示字段-
mysql> select isCaptured+0 AS Visible from DemoTable;
这将产生以下输出-
+---------+ | Visible | +---------+ | 0 | | 1 | | 0 | | 1 | +---------+ 4 rows in set (0.05 sec)