插入更新删除数据
2007-02-09 15:10
405 查看
插入数据
insert into mytable (id,name,age) values (1,xxiang,23)
从别的表中数据插入到mytable中
insert into my(id,name,age)
select id,name,age from othertable
从别的表中数据插入到新的表中,新表未创建(就是数据库中没有这个表)
select Id,name,age
insert into newtabel
from mytable
更新数据
update mytable set name='xxiang2007' where age=24 //有条件
update mytable set name='xxiang2007' //无条件,就是全部的数据
update mytable set name='xxiang2004' from newtable where id=10 //也可以用from从别的表写条件
删除数据
delete from mytable where name='xxiang2007' //有条件
delete from mytable //无条件,就是全部的数据
truncate table mytable //删除全部数据
delete from mytable from newtable where id =10 //也可以用from从别的表写条件,如两个表的关系了
insert into mytable (id,name,age) values (1,xxiang,23)
从别的表中数据插入到mytable中
insert into my(id,name,age)
select id,name,age from othertable
从别的表中数据插入到新的表中,新表未创建(就是数据库中没有这个表)
select Id,name,age
insert into newtabel
from mytable
更新数据
update mytable set name='xxiang2007' where age=24 //有条件
update mytable set name='xxiang2007' //无条件,就是全部的数据
update mytable set name='xxiang2004' from newtable where id=10 //也可以用from从别的表写条件
删除数据
delete from mytable where name='xxiang2007' //有条件
delete from mytable //无条件,就是全部的数据
truncate table mytable //删除全部数据
delete from mytable from newtable where id =10 //也可以用from从别的表写条件,如两个表的关系了
相关文章推荐
- 深入理解游标Cursors,实现数据的快速查找,插入,删除,更新(转)
- Android 内容提供器---内容提供器基础(插入、更新和删除数据)
- SQL语句,数据更新,数据插入删除修改和对视图的更新操作
- MySQL入门很简单-学习笔记 - 第11章 插入、更新与删除数据
- 在ASP.NET 2.0中操作数据之十七:研究插入、更新和删除的关联事件
- Scott Mitchell 的ASP.NET 2.0数据教程之十七:: 研究插入、更新和删除的关联事件
- MySQL插入、更新与删除数据 习题
- python对MySQL进行数据的插入、更新和删除之后需要commit,数据库才会真的有数据操作。(待日后更新)
- MSSQL 中使用modify()方法,此方法使用XML DML语句在XML 数据中插入,更新或删除节点
- 《MySQL必知必会》第十九二十章-插入数据与更新和删除数据
- 【T-MAC学习笔记10之--数据修改之插入数据,更新数据,删除数据】
- 数据库修改之更新员工表,根据ID删除Mapping表数据,再插入数据
- 插入数据 更新数据 删除数据
- Hibernate 数据的批量插入、更新和删除
- ArcEngine数据的查找,插入,删除,更新
- Oracle 触发器 插入,更新,删除,数据同步,两表同步
- Hibernate 数据的批量插入、更新和删除
- Hibernate 数据的批量插入、更新和删除
- c#数据删除,插入,更新
- php运用daodb插入、更新与删除数据