Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Commit 3b8d43c

Browse files
authored
updated syntaxsql tag
and added missing sql colorizer
1 parent 4f26f0d commit 3b8d43c

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

docs/t-sql/functions/min-transact-sql.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ monikerRange: ">=aps-pdw-2016||=azuresqldb-current||=azure-sqldw-latest||>=sql-s
3131

3232
## Syntax
3333

34-
```sql
35-
34+
```syntaxsql
3635
-- Aggregation Function Syntax
3736
MIN ( [ ALL | DISTINCT ] expression )
3837
@@ -72,7 +71,7 @@ MIN ( [ ALL ] expression ) OVER ( [ <partition_by_clause> ] [ <order_by_clause>
7271
### A. Simple example
7372
The following example returns the lowest (minimum) tax rate. The example uses the [!INCLUDE[ssSampleDBnormal](../../includes/sssampledbnormal-md.md)] database
7473

75-
```
74+
```sql
7675
SELECT MIN(TaxRate)
7776
FROM Sales.SalesTaxRate;
7877
GO
@@ -91,7 +90,7 @@ GO
9190
### B. Using the OVER clause
9291
The following example uses the MIN, MAX, AVG and COUNT functions with the OVER clause to provide aggregated values for each department in the `HumanResources.Department` table in the [!INCLUDE[ssSampleDBnormal](../../includes/sssampledbnormal-md.md)] database.
9392

94-
```
93+
```sql
9594
SELECT DISTINCT Name
9695
, MIN(Rate) OVER (PARTITION BY edh.DepartmentID) AS MinSalary
9796
, MAX(Rate) OVER (PARTITION BY edh.DepartmentID) AS MaxSalary
@@ -136,7 +135,7 @@ Tool Design 8.62 29.8462 23.505
136135
### C. Using MIN
137136
The following example uses the MIN aggregate function to return the price of the least expensive (minimum) product in a specified set of sales orders.
138137

139-
```
138+
```sql
140139
-- Uses AdventureWorks
141140

142141
SELECT DISTINCT MIN(UnitPrice)
@@ -154,7 +153,7 @@ WHERE SalesOrderNumber IN (N'SO43659', N'SO43660', N'SO43664');
154153
### D. Using MIN with OVER
155154
The following examples use the MIN OVER() analytic function to return the price of the least expensive product in each sales order. The result set is partitioned by the `SalesOrderID` column.
156155

157-
```
156+
```sql
158157
-- Uses AdventureWorks
159158

160159
SELECT DISTINCT MIN(UnitPrice) OVER(PARTITION BY SalesOrderNumber) AS LeastExpensiveProduct,

0 commit comments

Comments
 (0)