-
select <table fields list> from <table names list> where <row constraints specification> group by <grouping specification> having <grouping selection specification> order by <order rules specification>查看全部
-
結(jié)構(gòu)化查詢語言(Structured Query Language)查看全部
-
最基本的SQL語句查看全部
-
ER圖查看全部
-
元組 屬性列查看全部
-
最基本的SQL語句查看全部
-
RDBMS 關(guān)系型數(shù)據(jù)庫管理系統(tǒng)查看全部
-
分離--附加查看全部
-
附加數(shù)據(jù)庫:.mdf;還原數(shù)據(jù)庫:.bak查看全部
-
--count:統(tǒng)計(jì)結(jié)果數(shù) select count(SalesPersonID) from Sales.SalesOrderHeader where SalesPersonID is not null --distinct:獨(dú)一無二的 select distinct(SalesPersonID) from Sales.SalesOrderHeader where SalesPersonID is not null查看全部
-
--查詢null值 select * from Production.Product where size isnull --查詢非null select * from Production.Product where size is not null查看全部
-
在什么之間:between ... and ... 例: select SalesOrderID,OrderDate,SalesPersonID,TotalDue as TotalSales from Sales.SalesOrderHeader where Orderdate between '2005-08-01' and '1/1/2006' --通配符%,模糊搜索 select * from Production.Product where name like '%Mountain%' --通配符_,單個(gè)字符 select * from Production.Product where name like '_ountain%' --in:匹配多個(gè)字段,即集合 select * from Production.Product where color in ('red','white','black') --not in : 不等于某個(gè)字段 select * from Production.Product where class not in ('H','L')查看全部
-
--算術(shù)計(jì)算,round(rate*40*52,1),1代表小數(shù)點(diǎn)后保留一位小數(shù),0則不保留 select BusinessEntityID, rate*40*52 as AnnualSalary, round(rate*40*52,1) as AnnualSalary round(rate*40*52,0) as AnnualSalary from HumanResources.EmployeePayHistory查看全部
-
use AdventureWorks--選擇數(shù)據(jù)庫 select Top 10 * from Production.Product--輸出前10個(gè)數(shù)據(jù) --根據(jù)listprice和Name進(jìn)行降序排序 select ProductID, Name, ProductNumber, Color, Size, ListPrice from Production.Product order by listprice desc,Name desc --根據(jù)輸出的第二個(gè)列進(jìn)行排序,即Name select ProductID, Name, ProductNumber, Color, Size, ListPrice from Production.Product order by 2 --isnull:輸出時(shí)代替null值,例: select ProductID, Name, ProductNumber, isnull(Color,''), isnull(Size,''), ListPrice from Production.Product --as:別名,例: select ProductID, Name, ProductNumber, isnull(Color,'') as Color, isnull(Size,'') as Size123, --using an alias ListPrice from Production.Product --使用”+“連接字符 select ProductID, Name as ProductName, 'The list price for '+ProductNumber+'is $ '+convert(varchar,ListPrice)+'.' as Description from Production.Product查看全部
-
SQL查詢語句查看全部
舉報(bào)
0/150
提交
取消