1.upadte可以更改数据。格式为:
update 表名 set 想改的表头=‘想改成的值’ where 限定表头=‘限定的值’
用下面的例子说明一下就清楚了。
> update t_booktype set bookName=‘gameofthore’ where author=‘songzi’;
则把t_booktype表中的作者为“songzi”的书名改为“gameofthore”
如图所示:原来的数据
更改后的数据:(可以用select * from t_booktype查看表)对不起,我又唠叨了。
2.delete 是删除表中的某一行,格式为:
delete from 表名 where 限定表头=‘限定的值’
例子:
> delete from t_booktype where id=4;
这样,把id=4的那一行给删了。
原来的数据:
后面的数据为:
3.select是查找数据的方法。
- select * from t_booktype
这是最简单的语法,查看某一张表的全部
2.然而当数据太多时,不能这么查。这时候要限定:
1)select * from t_booktype where id>=3;
得到id是3、4的行
如图所示:
2)也可以选择显示的表头,比如我们不想显示作者的信息。
select id,bookName from t_booktype where id >=3;
结果如图所示:
今天又学了一点点。惭愧。明天要努力,把select的查询模型学了。