字符串未加引号会报错,都不会编译成功。
[db2inst1@t3-dtpoc-dtpoc-web04 ~]$ db2expln -d test -statement "select * from employee where name='lisss'" -terminal -graph -opids
Optimizer Plan:
Rows
Operator
(ID)
Cost
1
RETURN
( 1)
20.3034
|
1
FETCH
( 2)
20.3034
/ \
1 200003
IXSCAN Table:
( 3) DB2INST1
13.537 EMPLOYEE
|
4
Index:
DB2INST1
EMPLOYEE_INDEX2
[db2inst1@t3-dtpoc-dtpoc-web04 ~]$ db2expln -d test -statement "select * from employee where name=lisss" -terminal -graph -opids
Error compiling statement:
SQL0206N "LISSS" is not valid in the context where it is used.
SQLSTATE=42703
Statement:
select *
from employee
where name=lisss
[db2inst1@t3-dtpoc-dtpoc-web04 ~]$ db2 "select * from employee where name=lisss"
SQL0206N "LISSS" is not valid in the context where it is used.
SQLSTATE=42703
mysql> explain select * from employee where name='lisss';
+----+-------------+----------+------------+------+-----------------+-----------------+---------+-------+------+----------+-------+
| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+----+-------------+----------+------------+------+-----------------+-----------------+---------+-------+------+----------+-------+
| 1 | SIMPLE | employee | NULL | ref | employee_index2 | employee_index2 | 43 | const | 1 | 100.00 | NULL |
+----+-------------+----------+------------+------+-----------------+-----------------+---------+-------+------+----------+-------+
1 row in set, 1 warning (0.00 sec)
mysql> explain select * from employee where name=lisss;
ERROR 1054 (42S22): Unknown column 'lisss' in 'where clause'