必须会的SQL语句(四) 数据删除和更新
2015-01-03 00:00
211 查看
1.删除
1)删除记录
Delete from 表名 where id ='xx'
2)删除所有数据,并回归初始化标识字段。
Truncate table 表名
3)delete与truncate区别
a. truncate是能使种子回到初始值
b. truncate不能加条件
c. truncate不能涉及触发器
d. truncate性能要比delete高得多
2.更新
1)基础的update
update 表名
set [列名]='值'
where [列名] ='值'
2)和replace一起使用
--19岁以上名字中的'星'特换成'★'。
update 表名
set name = replace(name,'星','★')
where age > 19
1)删除记录
Delete from 表名 where id ='xx'
2)删除所有数据,并回归初始化标识字段。
Truncate table 表名
3)delete与truncate区别
a. truncate是能使种子回到初始值
b. truncate不能加条件
c. truncate不能涉及触发器
d. truncate性能要比delete高得多
2.更新
1)基础的update
update 表名
set [列名]='值'
where [列名] ='值'
2)和replace一起使用
--19岁以上名字中的'星'特换成'★'。
update 表名
set name = replace(name,'星','★')
where age > 19
相关文章推荐
- 必须会的SQL语句(四) 数据删除和更新
- 双表对比,获得新增、更新、删除数据的表,获得用于更新表的SQL语句方法
- 必须会的SQL语句(四)删除和更新
- SQL语句练习-更新和删除数据
- android中常用的查询、插入、更新、删除等SQL语句以及SQLite数据类型
- SQL语句,数据更新,数据插入删除修改和对视图的更新操作
- MySQL基本SQL语句之数据插入、删除数据和更新数据
- SQL语句--插入数据,更新数据,删除数据,建表,删表
- 使用T-SQL语句插入、更新、删除数据表
- 第二十九讲 ADO.NET(玩SQL语句) 实例补充之完善Excel删除数据及数据更新功能
- 用LINQ to SQL 进行数据访问、更新和删除(附Demo示例程序下载)
- SQL-数据的插入、更新和删除 (转载)
- 删除父子结构表中数据SQL语句
- sql语句 删除数据中的前后空格
- 9、步步为营VS 2008 + .NET 3.5(9) - DLINQ(LINQ to SQL)之执行SQL语句的添加、查询、更新和删除
- 步步为营VS 2008 + .NET 3.5(9) - DLINQ(LINQ to SQL)之执行SQL语句的添加、查询、更新和删除
- 常用SQL语句实例(含过滤及删除重复数据、导入导出数据等)
- 常用SQL语句实例大全(含过滤及删除重复数据、导入导出数据等)
- 查询和删除表中重复数据sql语句
- 将A表数据更新到B表相关列的SQL语句