简单数据查询语句

1,查询语句
语法:select 字段名 from 数据表名 where 查询条件 order by 排列方式 (不加desc从低到高排序,加上相反)
举例:仅查询“shujubiao”表中“xuhao”,“xingming”两个字段,并且“xuhao”要大于3,结果按“xuhao”倒序排列:
SQL语句:select xuhao,xingming from shujubiao where xuhao>3 order by xuhao desc

2,删除记录
语法:delete from 数据表 where 条件
举例:删除“xingming”为“小布什”的记录:
SQL语句:delete from shujubiao where xingming='小布什'

3,添加记录
语法:insert into 数据表 (字段名) values (字段值)
举例:插入一条新记录,“xingming”为“火山”,“yuwen”为“100”,“shuxue”是“1000”:
SQL语句:insert into shujubiao (xingming, yuwen, shuxue) values ('火山',100,1000)
说明:“xuhao”字段为“自动编号类型”,不需要赋值。

4,更新记录
语法:update 数据表 set 字段值=新值 where 条件
举例:把“xuhao”为“1”的记录中“xingming”字段改为“寂寞火山”,“yuwen”字段改为“200”
SQL语句:update shujubiao set xingming='寂寞火山',yuwen=200 where xuhao=1
 

之前所写,迁移至此

原文链接:http://user.qzone.qq.com/372806800/blog/1345306299

原文地址:https://www.cnblogs.com/amwuau/p/6235971.html