-
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>查看全部
-
結構化查詢語言(Structured Query Language)查看全部
-
最基本的SQL語句查看全部
-
ER圖查看全部
-
元組 屬性列查看全部
-
最基本的SQL語句查看全部
-
RDBMS 關系型數據庫管理系統查看全部
-
分離--附加查看全部
-
附加數據庫:.mdf;還原數據庫:.bak查看全部
-
--count:統計結果數 select count(SalesPersonID) from Sales.SalesOrderHeader where SalesPersonID is not null --distinct:獨一無二的 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%' --通配符_,單個字符 select * from Production.Product where name like '_ountain%' --in:匹配多個字段,即集合 select * from Production.Product where color in ('red','white','black') --not in : 不等于某個字段 select * from Production.Product where class not in ('H','L')查看全部
-
--算術計算,round(rate*40*52,1),1代表小數點后保留一位小數,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--選擇數據庫 select Top 10 * from Production.Product--輸出前10個數據 --根據listprice和Name進行降序排序 select ProductID, Name, ProductNumber, Color, Size, ListPrice from Production.Product order by listprice desc,Name desc --根據輸出的第二個列進行排序,即Name select ProductID, Name, ProductNumber, Color, Size, ListPrice from Production.Product order by 2 --isnull:輸出時代替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查詢語句查看全部
舉報
0/150
提交
取消