本文共 679 字,大约阅读时间需要 2 分钟。
插入数据:insert into 表名(列名1,列名2.........)values (值1,值2)
如果插入多条数据则insert into 表名(列名1,列名2.........)values (值1,值2),(值1,值2)...
2. 查询数据:select * from 表名 //查询表中所有数据,其中*可以改为列名进行详细查找
3.更新数据:update 表名 set 列名=新名称 where 更新条件
实例:
将id为1的手机号改为默认的"-": update students set tel=default where id=1;
将所有人的年龄增加1: update students set age=age+1;
将手机号为 13288097888 的姓名改为 "张三", 年龄改为 19: update students set name="张三", age=19 where tel="13288097888"; 4.删除数据:delete 语句用于删除表中的数据, 基本用法为: delete from 表名称 where 删除条件;使用示例:
删除id为2的行: delete from students where id=3; 删除所有年龄小于21岁的数据: delete from students where age<18; 删除表中的所有数据: delete from students;
本文转自 水滴的历程 51CTO博客,原文链接:http://blog.51cto.com/12390959/1881939
转载地址:http://edkum.baihongyu.com/