为什么这样的事情不起作用?
mysql> SELECT * FROM employees FORCE INDEX(emp_no) WHERE emp_no = '77899';
表如下所示:
+------------+---------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+---------------+------+-----+---------+-------+
| emp_no | int(11) | NO | PRI | NULL | |
| birth_date | date | NO | | NULL | |
| first_name | varchar(14) | NO | | NULL | |
| last_name | varchar(16) | NO | | NULL | |
| gender | enum('M','F') | NO | | NULL | |
| hire_date | date | NO | | NULL | |
+------------+---------------+------+-----+---------+-------+
6 rows in set (0.01 sec)
我得到的错误是:
ERROR 1176 (42000): Key 'emp_no' doesn't exist in table 'employees'