比較實用SQL語句總結
更新時間:2008年04月30日 18:42:49 作者:
sql語句查詢,比較實用的技巧
id name
1 a
2 b
3 c
1 a
2 b
3 c
以下的sql語句都以上面表mytable為準:
1、查詢id=1,3記錄的所有數(shù)據(jù) select * from mytable
where id in(1,3)
2、刪除id重復的數(shù)據(jù),表中數(shù)據(jù)只剩下id=1,2,3的所有數(shù)據(jù) select * into # from mytable
truncate table mytable
insert table select distinct * from #
select * from table
drop table #
1 a
2 b
3 c
1 a
2 b
3 c
以下的sql語句都以上面表mytable為準:
1、查詢id=1,3記錄的所有數(shù)據(jù) select * from mytable
where id in(1,3)
2、刪除id重復的數(shù)據(jù),表中數(shù)據(jù)只剩下id=1,2,3的所有數(shù)據(jù) select * into # from mytable
truncate table mytable
insert table select distinct * from #
select * from table
drop table #
相關文章
使用 Navicat 創(chuàng)建數(shù)據(jù)庫并用JDBC連接的操作方法
這篇文章主要介紹了使用 Navicat 創(chuàng)建數(shù)據(jù)庫并用JDBC連接的操作方法,本文給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下2020-11-11
ms SQL server數(shù)據(jù)庫備份、壓縮與SQL數(shù)據(jù)庫數(shù)據(jù)處理的方法
ms SQL server數(shù)據(jù)庫備份、壓縮與SQL數(shù)據(jù)庫數(shù)據(jù)處理的方法...2007-07-07

