SqlSever基礎 count 查詢一個表有多少行

來源:互聯網
上載者:User

標籤:ble   cat   簡單   ide   tab   data   teacher   sqlsever   char   

鎮場詩:
———大夢誰覺,水月中建部落格。百千磨難,才知世事無常。
———今持佛語,技術無量願學。願盡所學,鑄一良心部落格。
——————————————————————————————————————————

1 table

 

 

 

2 code

 1 --建立一個資料庫 2 create database helloworld1 3  4 use master 5 drop database helloworld1 6  7 --用helloworld1這個資料庫 8 use helloworld1 9 10 --建立一個表格teacher11 create table Teacher12 (13    Id int primary key identity(1,1),   14    Name nvarchar(10),15    Class nchar(2)16 )17 18 create table Location19 (20    Class nchar(2),21    location nvarchar(5)22 )23 24 --看看 teacher這個表格有啥25 select * from Teacher26 select * from Location27 28 --向這個Teacher中插入這幾行內容,這個內容我插入一遍後,簡單修改,又插入一遍29 insert into Teacher30        values(‘文殊菩薩‘,‘佛家‘),31              (‘普賢菩薩‘,‘佛家‘),32              (‘觀音菩薩‘,‘佛家‘),33              (‘道德天尊‘,‘道家‘),34              (‘靈寶天尊‘,‘道家‘),35              (‘太白金星‘,‘道家‘),36              (‘廣寒仙子‘,‘道家‘)37 38 --向這個Location中插入這幾行內容39 insert into Location40         values(‘佛家‘,‘印度‘),41               (‘道家‘,‘中國‘),42               (‘基督‘,‘西方‘),43               (‘儒家‘,‘中國‘)44 45 --查看teacher表中有什麼內容46 select * from Teacher47 48 --輸出一個列名teacherCount,內容為 teacher表的行數49 select count(*) as teacherCount from Teacher

 

 

3 show

 

 

 

 

——————————————————————————————————————————
博文的精髓,在技術部分,更在鎮場一詩。
SqlSever是優秀的語言,值得努力學習。熟悉資料庫的增刪查改,寫程式必備。
如果博文的內容有可以改進的地方,甚至有錯誤的地方,請留下評論,我一定努力改正,爭取鑄成一個良心部落格。
註:此文僅作為科研學習,如果我無意中侵犯了您的權益,請務必及時告知,我會做出改正。

SqlSever基礎 count 查詢一個表有多少行

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.