国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數(shù)據(jù)庫 > SQL Server > 正文

關(guān)于SQL Server查詢語句的使用

2024-08-31 00:44:00
字體:
供稿:網(wǎng)友

一.查詢第二個字母是t或者a的雇員的全部信息

復制代碼 代碼如下:


select *
from employees
where firstname like '_[t,a]%'


注意:在sql中%表示字符串,所以不可像matlab一樣用其注釋,兩個雙斜線好像也不行,/**/可以,有網(wǎng)友說sql單行注釋為--

二.更改字段名

復制代碼 代碼如下:


select '名字' = firstname ,'姓氏' = lastname
from employees
where firstname like '_[t,a]%'


或者

復制代碼 代碼如下:


select firstname as '名字' , lastname as '姓氏'
from employees
where firstname like '_[t,a]%'


三.top關(guān)鍵字

復制代碼 代碼如下:


/*檢索出符合條件的前70%條記錄*/
select top 70 percent firstname as '名字' , lastname as '姓氏'
from employees
where firstname like '_[t,a]%'1 /*檢索出符合條件的前2條記錄*/
select top 2 firstname as '名字' , lastname as '姓氏'
from employees
where firstname like '_[t,a]%'


四.union關(guān)鍵字
注意:標準sql只提供了并操作,未提供交(intersection)和差(minus)操作。

復制代碼 代碼如下:


select *
from employees
where target='_blank'>服務(wù)器: 消息 8163,級別 16,狀態(tài) 4,行 1
不能以 DISTINCT 方式選擇 text、ntext 或 image 數(shù)據(jù)類型。

復制代碼 代碼如下:


select *
from employees
where src="http://www.aspku.com/uploads/allimg/130603/111U2NF_1.jpg">

注意:order by是必須的,并且 compute by后的參數(shù)應(yīng)該在order by后的參數(shù)中出現(xiàn)過

復制代碼 代碼如下:


select sex,sclass,score
from student
compute sum(score)

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 资源县| 个旧市| 合作市| 郯城县| 吴忠市| 长宁县| 娄底市| 山阴县| 竹溪县| 揭东县| 同心县| 高雄市| 永安市| 临朐县| 海伦市| 多伦县| 五常市| 井陉县| 阿拉善右旗| 务川| 班玛县| 英吉沙县| 万载县| 陵川县| 亳州市| 华亭县| 五莲县| 玛曲县| 小金县| 梧州市| 铜陵市| 恩平市| 唐河县| 云霄县| 宁津县| 九龙城区| 永康市| 诸暨市| 黔西县| 凤阳县| 邹平县|