SQL 實(shí)用語句
發(fā)布日期:2022-02-01 18:52 | 文章來源:腳本之家
1 a
2 b
3 c
1 a
2 b
3 c 以下的sql語句都以上面表mytable為準(zhǔn): 1、查詢id=1,3記錄的所有數(shù)據(jù)
復(fù)制代碼 代碼如下:
select * from mytable where id in(1,3)
2、刪除id重復(fù)的數(shù)據(jù),表中數(shù)據(jù)只剩下id=1,2,3的所有數(shù)據(jù)
復(fù)制代碼 代碼如下:
select * into # from mytable
truncate table mytable insert table select distinct * from #
select * from table
drop table #
3、創(chuàng)建一個(gè)新表 films_recent ,它的值包含來自表films
復(fù)制代碼 代碼如下:
SELECT * INTO films_recent FROM films
版權(quán)聲明:本站文章來源標(biāo)注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請保持原文完整并注明來源及原文鏈接。禁止復(fù)制或仿造本網(wǎng)站,禁止在非maisonbaluchon.cn所屬的服務(wù)器上建立鏡像,否則將依法追究法律責(zé)任。本站部分內(nèi)容來源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來,僅供學(xué)習(xí)參考,不代表本站立場,如有內(nèi)容涉嫌侵權(quán),請聯(lián)系alex-e#qq.com處理。
相關(guān)文章
關(guān)注官方微信