- aggregation function
the Use AdventureWorksLT2008
Go
Avg()
: Select avg (score1) as scores 1, avg (score2) as scores 2 from table
SUM()
: Select sum (score1) as scores 1, sum (score2) as scores 2 from the table name.
Max();Min()
: select max (score1), min (score2) from table
dictinct cancel repeated only immediately after the select, order by order
like fuzzy query
group by grouping queries
Select the column name from table group by id
Type conversion:
Select CustomerId+Title from SatelsLT.Customer
- type conversion
-> Convert (target type, conversion of expression, format specification)
-> Cast (expression as type)
Select Convert (nvarchar(32),CustomerId) +Title from SalesLT.Customer
Select cast (CustomerId as nvarchar(32) )+Title from SalesLT.customer
Date Functions
Select getdate () // Get the current date