Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
isfd committed Sep 1, 2018
1 parent 8439b33 commit 1c1d4fb
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 5 deletions.
47 changes: 45 additions & 2 deletions sqlfun/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,54 @@ This document explains the structure used to document a database function in the

### funcName
Name of the function. Function has the same name but has the different arguments syntax will be documented
in a different file.
in the different file.

funcName can't be null.

### arguments
### *arguments
Array of the argument object. This list is empty when a function has no argument.

### argument
Function argument with below properties.

#### *arguName
argument name.

#### *dataTypes
dataType of the argument, an argument may has more than one dataType, so this property is array.

#### description
Explanation of this argument.

#### optional
Is this argument optional in the argument list.

### clauses
SQL clauses used in the function, such as over clause in analytic function.

### *returnType
return dataType of this function.

### description
Explanation of this function.

### *targetDBs
The database version this function is applied to.

### *category
The category this function belongs to, such as string function.

### ansiCompatible
Compatible with ANSI SQL.

### package
The package this function belongs to, usually, it's Oracle plsql function.

### docLink
The online document for this function.

### sample
Sample SQL including this function.

```json
{
Expand Down
4 changes: 2 additions & 2 deletions sqlfun/sqlFuncSample.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@
"integer",
"bigint"
],
"required": "optional",
"optional": true,
"description": "The number of rows back from the current row from which to obtain a value"
}
},
{
"argument": {
"arguName": "default",
"dataTypes": [],
"required": "optional",
"optional": true,
"description": "The value to return when scalar_expression at offset is NULL"
}
}
Expand Down
17 changes: 16 additions & 1 deletion sqlfun/sqlserver/avg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
{
"funcName": "AVG",
"allDistinct": "optional",
"arguments": [
{
"argument": {
"arguName": "all",
"dataTypes": [],
"optional": true,
"description": "Applies the aggregate function to all values. ALL is the default"
}
},
{
"argument": {
"arguName": "distinct",
"dataTypes": [],
"optional": true,
"description": "Specifies that AVG operates only on one unique instance of each value, regardless of how many times that value occurs"
}
},
{
"argument": {
"arguName": "expression",
Expand Down
54 changes: 54 additions & 0 deletions sqlfun/sqlserver/count.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"funcName": "COUNT",
"arguments": [{
"argument": {
"arguName": "all",
"dataTypes": [],
"optional": true,
"description": "Applies the aggregate function to all values. ALL serves as the default"
}
},
{
"argument": {
"arguName": "distinct",
"dataTypes": [],
"optional": true,
"description": "Specifies that COUNT returns the number of unique nonnull values"
}
},
{
"argument": {
"arguName": "expression",
"dataTypes": [],
"optional": true,
"description": "An expression of any type, except image, ntext, or text"
}
},
{
"argument": {
"arguName": "*",
"dataTypes": [],
"optional": true,
"description": "Specifies that COUNT should count all rows to determine the total table row count to return"
}
}
],
"clauses": [{
"clause": {
"clauseName": "over",
"clauseContent": "[ partition_by_clause ] [order_by_clause] [ ROW_or_RANGE_clause ] ) "
}
}],
"returnType": "int",
"description": "This function returns the number of items found in a group",
"comment": "-- Syntax for SQL Server and Azure SQL Database",
"targetDBs": ["2008+",
"Azure SQL Database",
"Azure SQL Warehouse",
"Parallel Data Warehouse"],
"category": "Aggregate",
"ansiCompatible": "",
"package": "",
"docLink": "https://docs.microsoft.com/en-us/sql/t-sql/functions/count-transact-sql?view=sql-server-2017",
"sample": "SELECT COUNT(DISTINCT Title) FROM HumanResources.Employee;"
}

0 comments on commit 1c1d4fb

Please sign in to comment.