做了一个表sicence_fiction_film,如图所示:,想删除名字列中aaa这一行,输入如下:
delete from sicence_fiction_film where name=aaa;
结果却报错说不知道列aaa在哪儿?
求解答?
delete from sicence_fiction_film where name
='aaa';
name在数据库是varchar类型的要加上单引号,就好比java里面的字符串要加上双引号一样,否则就会报错。
delete from sicence_fiction_film where `name`='aaa';
关键字要转义,aaa要引号
delete from sicence_fiction_film where name="aaa";
条件设置时字符串要加上""号的。
这行报错,一般会在=附近提示这边报错,就应该知道是name=aaa;报错的,然后检查这边 的字段类型是否匹配
每种语言都有关键字,多多注意就是啦!~