-
select SalesPersonID,OrderDate,Max(TotalDue) as MaximumTotalSales from [Sales].[SalesOrderHeader] where SalesPersonID is not null group by SalesPersonID,OrderDate having Max(TotalDue)>150000 --只能是select语句选出的有聚合的列,如果要放没聚合的列,只能放到where子句下! order by SalesPersonID查看全部
-
select SalesPersonID,Max(TotalDue) as MaximumTotalSales from [Sales].[SalesOrderHeader] --Error Message: Column 'Sales.SalesOrderHeader.SalesPersonID' is invalid in the select list --because it is not contained in either an aggregate function or the GROUP BY clause.查看全部
-
select count(distinct(SalesPersonID)) from [Sales].[SalesOrderHeader] where SalesPersonID is not null查看全部
-
select * from [Production].[Product] where size in ('60','61','62') size 数据类型是nvarchar查看全部
-
select BusinessEntityID ,rate*40*52 as AnnualSalary ,round(rate*40*52,1) as AnnualSalary ,round(rate*40*52,0) as AnnualSalary from [HumanResources].[EmployeePayHistory] select BusinessEntityID ,(rate+5)*40*52 as AnnualSalary from [HumanResources].[EmployeePayHistory]查看全部
-
select ProductID, Name as ProductName, --using an alias 'The list price for ' + ProductNumber + ' is $ ' + convert(varchar,ListPrice) +'.' ,--using the concatenation to join character end-to-end. 'The list price for ' + ProductNumber + ' is $ ' + convert(varchar,ListPrice) +'.' as [Description] --using brackets to let SQL server conside the strin as a column name from Production.Product查看全部
-
select ProductID, Name, ProductNumber, isnull(Color,''), isnull(Size,''), ListPrice from Production.Product查看全部
-
select ProductID, Name, ProductNumber, Color, Size, ListPrice from Production.Product order by 2查看全部
-
select Top 100 * from [dbo].[DatabaseLog]查看全部
-
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>查看全部
-
哈哈查看全部
-
use语句 use [...(用的DB)] go(可有可无) 选中use语句后,F5或execute执行查看全部
-
SQL(query)结构化查询语言,T-SQL query:从DB中查询索取需要的data info 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>查看全部
-
relational 关系数据库管理系统RDBMS 外键(foreign key )主键(primary key),它俩将两张表联系(relationship),row/record,column/attribute,field/cell(小格子,字段),一张表的主键是另一张的外键(一张表的外键是另一张的主键),主键可以建立在每张表中单列或多列上。主键是用来唯一地标识一行数据,且主键列必须包含唯一的值,且不能包含空值。查看全部
-
schema 数据库中 一些对象的集合,近似于一个user查看全部
举报
0/150
提交
取消