-
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
提交
取消