人妖在线一区,国产日韩欧美一区二区综合在线,国产啪精品视频网站免费,欧美内射深插日本少妇

新聞動(dòng)態(tài)

sql server 入門(mén)語(yǔ)句總結(jié)

發(fā)布日期:2022-01-05 11:36 | 文章來(lái)源:源碼中國(guó)

對(duì)于數(shù)據(jù)庫(kù)來(lái)說(shuō)多多少少要掌握一點(diǎn),首先基本的SQL語(yǔ)句要了解。下面來(lái)總結(jié)一些入門(mén)級(jí)別的SQL語(yǔ)句。

create相關(guān)

•show database; 顯示出現(xiàn)有的數(shù)據(jù)庫(kù)
•use database_x; 現(xiàn)在要使用數(shù)據(jù)庫(kù)database_x
•create table coffee (id int(5) not null,coffee_name varchar(25)); 創(chuàng)建一張表,包含id和coffee_name兩個(gè)字段
•alter table coffee add taste varchar(10); 增加新的一列
•insert into coffee (id,coffee_name,taste,rank) value ("1","BlueMountain",“well”,“5”); 插入數(shù)據(jù)
•show columns from coffee; 查看表結(jié)構(gòu)
•show create table coffee; 查看表信息,包括建表語(yǔ)句
•alter table student rename ss; 改變表名
•alter table ss drop mark; 刪除表ss中mark列
select語(yǔ)句

•select * from coffee where id="1"; 查詢出id=1的所有信息
•select coffee_name from coffee where id="2"; 查詢出id=2的coffee name
•select * from club where id between "1" and "3"; 查詢出id=1到3的條目
•select * from club where id="1" or id="3"; 查詢出id=1和id=3這兩個(gè)條目
•select club_name from club where mark>50; 查詢出mark大于50的club
•select club_name from club where mark not between 48 and 50; 查詢mark不在48與50之間的club
•select * from club where id in("1","3","4"); 查詢id=1,3,4的條目
•select * from club where id not in("1","3","4");
•select * from club where name like "M%r"; 通配符%表示任意長(zhǎng)度的字符(可以是0,漢字為兩個(gè)字符)
•select * from club where name like "M_r"; _表示單個(gè)字符
•select * from club where id in("1","3","4") and mark>50; 多重查詢
•select * from club order by mark desc; 按照mark降序排列(desc:降序,usc:升序)
數(shù)量查詢相關(guān)

•select count(*) from club; 查詢club中有多少條記錄
•select count(distinct mark) from club; 不同分?jǐn)?shù)的有多少條記錄
•select sum(mark) from club; 積分總和
•select avg(mark) from club; 平均積分
•select max(mark) from club; 最高積分
•select min(mark) from club; 最低積分
update語(yǔ)句

•update club set mark=mark-8 where id="1"; id=1的俱樂(lè)部積分罰8分
delete語(yǔ)句

•delete from club where id="001"; 刪除id=001的俱樂(lè)部信息
以上語(yǔ)句都是SQL語(yǔ)句增刪改查最基本的部分,屬于入門(mén)級(jí)別,一定要掌握。

版權(quán)聲明:本站文章來(lái)源標(biāo)注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請(qǐng)保持原文完整并注明來(lái)源及原文鏈接。禁止復(fù)制或仿造本網(wǎng)站,禁止在非www.sddonglingsh.com所屬的服務(wù)器上建立鏡像,否則將依法追究法律責(zé)任。本站部分內(nèi)容來(lái)源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來(lái),僅供學(xué)習(xí)參考,不代表本站立場(chǎng),如有內(nèi)容涉嫌侵權(quán),請(qǐng)聯(lián)系alex-e#qq.com處理。

相關(guān)文章

實(shí)時(shí)開(kāi)通

自選配置、實(shí)時(shí)開(kāi)通

免備案

全球線路精選!

全天候客戶服務(wù)

7x24全年不間斷在線

專屬顧問(wèn)服務(wù)

1對(duì)1客戶咨詢顧問(wèn)

在線
客服

在線客服:7*24小時(shí)在線

客服
熱線

400-630-3752
7*24小時(shí)客服服務(wù)熱線

關(guān)注
微信

關(guān)注官方微信
頂部