让我们首先创建一个表-
mysql> create table DemoTable1460 -> ( -> Name varchar(20) -> );
使用插入命令在表中插入一些记录-
mysql> insert into DemoTable1460 values('Chris'); mysql> insert into DemoTable1460 values('David'); mysql> insert into DemoTable1460 values('Bob'); mysql> insert into DemoTable1460 values('Robert');
使用select语句显示表中的所有记录-
mysql> select * from DemoTable1460;
这将产生以下输出-
+--------+ | Name | +--------+ | Chris | | David | | Bob | | Robert | +--------+ 4 rows in set (0.00 sec)
以下是使用“ IN”实现不区分大小写的SELECT的查询-
mysql> select * from DemoTable1460 where UPPER(Name) IN('CHRIS','BOB');
这将产生以下输出-
+-------+ | Name | +-------+ | Chris | | Bob | +-------+ 2 rows in set (0.00 sec)