Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions src/UserGuide/Master/Table/SQL-Manual/Featured-Functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@

### 1.1 `date_bin` Function

#### **Description:**
#### **Description**

The `date_bin` function is a scalar function that aligns timestamps to the start of specified time intervals. It is commonly used with the `GROUP BY` clause for downsampling.

- **Partial Intervals May Be Empty:** Only timestamps that meet the conditions are aligned; missing intervals are not filled.
- **All Intervals Return Empty:** If no data exists within the query range, the downsampling result is an empty set.

#### **Usage** **Examples****:**
#### **Usage Examples**

**Sample Dataset****:** The example data page contains SQL statements for building table structures and inserting data. Download and execute these statements in the IoTDB CLI to import the data into IoTDB. You can use this data to test and execute the SQL statements in the examples and obtain the corresponding results.
[Sample Dataset](../Reference/Sample-Data.md): The example data page contains SQL statements for building table structures and inserting data. Download and execute these statements in the IoTDB CLI to import the data into IoTDB. You can use this data to test and execute the SQL statements in the examples and obtain the corresponding results.

**Example 1: Hourly Average Temperature for Device 100**

Expand All @@ -45,7 +45,7 @@ WHERE (time >= 2024-11-27 00:00:00 AND time <= 2024-11-30 00:00:00)
GROUP BY 1;
```

**Result****:**
**Result**

```Plain
+-----------------------------+--------+
Expand All @@ -69,7 +69,7 @@ WHERE time >= 2024-11-27 00:00:00 AND time <= 2024-11-30 00:00:00
GROUP BY 1, device_id;
```

**Result:**
**Result**

```Plain
+-----------------------------+---------+--------+
Expand All @@ -95,7 +95,7 @@ SELECT date_bin(1h, time) AS hour_time, avg(temperature) AS avg_temp
group by 1;
```

**Result:**
**Result**

```Plain
+-----------------------------+--------+
Expand Down Expand Up @@ -127,13 +127,13 @@ The `date_bin_gapfill` function is an extension of `date_bin` that fills in miss
2. A `GROUP BY` clause can contain only one instance of date_bin_gapfill. Multiple calls will result in an error.
3. The `GAPFILL` operation occurs after the `HAVING` clause and before the `FILL` clause.
4. The `WHERE` clause must include time filters in one of the following forms:
1. `time >= XXX AND time <= XXX`
2. `time > XXX AND time < XXX`
3. `time BETWEEN XXX AND XXX`
1. `time >= XXX AND time <= XXX`
2. `time > XXX AND time < XXX`
3. `time BETWEEN XXX AND XXX`
5. If additional time filters or conditions are used, an error is raised. Time conditions and other value filters must be connected using the `AND` operator.
6. If `startTime` and `endTime` cannot be inferred from the `WHERE` clause, an error is raised.

**Usage** **Examples****:**
**Usage Examples**

**Example 1: Fill Missing Intervals**

Expand All @@ -145,7 +145,7 @@ WHERE (time >= 2024-11-28 07:00:00 AND time <= 2024-11-28 16:00:00)
GROUP BY 1;
```

**Result:**
**Result**

```Plain
+-----------------------------+--------+
Expand Down Expand Up @@ -173,7 +173,7 @@ WHERE time >= 2024-11-28 07:00:00 AND time <= 2024-11-28 16:00:00
GROUP BY 1, device_id;
```

**Result:**
**Result**

```Plain
+-----------------------------+---------+--------+
Expand Down Expand Up @@ -201,7 +201,7 @@ WHERE time >= 2024-11-27 09:00:00 AND time <= 2024-11-27 14:00:00
GROUP BY 1, device_id;
```

**Result:**
**Result**

```Plain
+---------+---------+--------+
Expand Down Expand Up @@ -242,7 +242,7 @@ DIFF(numberic[, boolean]) -> Double
- In **tree models**, the second parameter must be specified as `'ignoreNull'='true'` or `'ignoreNull'='false'`.
- In **table models**, simply use `true` or `false`. Using `'ignoreNull'='true'` or `'ignoreNull'='false'` in table models results in a string comparison and always evaluates to `false`.

### 2.5 **Usage** **Examples****:**
### 2.5 **Usage Examples**

#### **Example 1: Ignore NULL Values**

Expand All @@ -252,7 +252,7 @@ FROM table1
WHERE device_id = '100';
```

**Result:**
**Result**

```Plain
+-----------------------------+---------+
Expand All @@ -277,7 +277,7 @@ FROM table1
WHERE device_id = '100';
```

**Result:**
**Result**

```Plain
+-----------------------------+---------+
Expand All @@ -304,7 +304,7 @@ FROM table1
WHERE device_id = '100';
```

**Result:**
**Result**

```Plain
+-----------------------------+-----------+-----------+-----------+
Expand Down
34 changes: 17 additions & 17 deletions src/UserGuide/latest-Table/SQL-Manual/Featured-Functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@

### 1.1 `date_bin` Function

#### **Description:**
#### **Description**

The `date_bin` function is a scalar function that aligns timestamps to the start of specified time intervals. It is commonly used with the `GROUP BY` clause for downsampling.

- **Partial Intervals May Be Empty:** Only timestamps that meet the conditions are aligned; missing intervals are not filled.
- **All Intervals Return Empty:** If no data exists within the query range, the downsampling result is an empty set.

#### **Usage** **Examples****:**
#### **Usage Examples**

**Sample Dataset****:** The example data page contains SQL statements for building table structures and inserting data. Download and execute these statements in the IoTDB CLI to import the data into IoTDB. You can use this data to test and execute the SQL statements in the examples and obtain the corresponding results.
[Sample Dataset](../Reference/Sample-Data.md): The example data page contains SQL statements for building table structures and inserting data. Download and execute these statements in the IoTDB CLI to import the data into IoTDB. You can use this data to test and execute the SQL statements in the examples and obtain the corresponding results.

**Example 1: Hourly Average Temperature for Device 100**

Expand All @@ -45,7 +45,7 @@ WHERE (time >= 2024-11-27 00:00:00 AND time <= 2024-11-30 00:00:00)
GROUP BY 1;
```

**Result****:**
**Result**

```Plain
+-----------------------------+--------+
Expand All @@ -69,7 +69,7 @@ WHERE time >= 2024-11-27 00:00:00 AND time <= 2024-11-30 00:00:00
GROUP BY 1, device_id;
```

**Result:**
**Result**

```Plain
+-----------------------------+---------+--------+
Expand All @@ -95,7 +95,7 @@ SELECT date_bin(1h, time) AS hour_time, avg(temperature) AS avg_temp
group by 1;
```

**Result:**
**Result**

```Plain
+-----------------------------+--------+
Expand Down Expand Up @@ -127,13 +127,13 @@ The `date_bin_gapfill` function is an extension of `date_bin` that fills in miss
2. A `GROUP BY` clause can contain only one instance of date_bin_gapfill. Multiple calls will result in an error.
3. The `GAPFILL` operation occurs after the `HAVING` clause and before the `FILL` clause.
4. The `WHERE` clause must include time filters in one of the following forms:
1. `time >= XXX AND time <= XXX`
2. `time > XXX AND time < XXX`
3. `time BETWEEN XXX AND XXX`
1. `time >= XXX AND time <= XXX`
2. `time > XXX AND time < XXX`
3. `time BETWEEN XXX AND XXX`
5. If additional time filters or conditions are used, an error is raised. Time conditions and other value filters must be connected using the `AND` operator.
6. If `startTime` and `endTime` cannot be inferred from the `WHERE` clause, an error is raised.

**Usage** **Examples****:**
**Usage Examples**

**Example 1: Fill Missing Intervals**

Expand All @@ -145,7 +145,7 @@ WHERE (time >= 2024-11-28 07:00:00 AND time <= 2024-11-28 16:00:00)
GROUP BY 1;
```

**Result:**
**Result**

```Plain
+-----------------------------+--------+
Expand Down Expand Up @@ -173,7 +173,7 @@ WHERE time >= 2024-11-28 07:00:00 AND time <= 2024-11-28 16:00:00
GROUP BY 1, device_id;
```

**Result:**
**Result**

```Plain
+-----------------------------+---------+--------+
Expand Down Expand Up @@ -201,7 +201,7 @@ WHERE time >= 2024-11-27 09:00:00 AND time <= 2024-11-27 14:00:00
GROUP BY 1, device_id;
```

**Result:**
**Result**

```Plain
+---------+---------+--------+
Expand Down Expand Up @@ -242,7 +242,7 @@ DIFF(numberic[, boolean]) -> Double
- In **tree models**, the second parameter must be specified as `'ignoreNull'='true'` or `'ignoreNull'='false'`.
- In **table models**, simply use `true` or `false`. Using `'ignoreNull'='true'` or `'ignoreNull'='false'` in table models results in a string comparison and always evaluates to `false`.

### 2.5 **Usage** **Examples****:**
### 2.5 **Usage Examples**

#### **Example 1: Ignore NULL Values**

Expand All @@ -252,7 +252,7 @@ FROM table1
WHERE device_id = '100';
```

**Result:**
**Result**

```Plain
+-----------------------------+---------+
Expand All @@ -277,7 +277,7 @@ FROM table1
WHERE device_id = '100';
```

**Result:**
**Result**

```Plain
+-----------------------------+---------+
Expand All @@ -304,7 +304,7 @@ FROM table1
WHERE device_id = '100';
```

**Result:**
**Result**

```Plain
+-----------------------------+-----------+-----------+-----------+
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

###### 示例数据

在[示例数据页面](https://timechor.feishu.cn/docx/YEubdhNGkoaPdnxNolBcaMMKnoe)中,包含了用于构建表结构和插入数据的SQL语句,下载并在IoTDB CLI中执行这些语句,即可将数据导入IoTDB,您可以使用这些数据来测试和执行示例中的SQL语句,并获得相应的结果。
在[示例数据页面](../Reference/Sample-Data.md)中,包含了用于构建表结构和插入数据的SQL语句,下载并在IoTDB CLI中执行这些语句,即可将数据导入IoTDB,您可以使用这些数据来测试和执行示例中的SQL语句,并获得相应的结果。

示例 1:获取设备** **`100`** **某个时间范围的每小时平均温度

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

###### 示例数据

在[示例数据页面](https://timechor.feishu.cn/docx/YEubdhNGkoaPdnxNolBcaMMKnoe)中,包含了用于构建表结构和插入数据的SQL语句,下载并在IoTDB CLI中执行这些语句,即可将数据导入IoTDB,您可以使用这些数据来测试和执行示例中的SQL语句,并获得相应的结果。
在[示例数据页面](../Reference/Sample-Data.md)中,包含了用于构建表结构和插入数据的SQL语句,下载并在IoTDB CLI中执行这些语句,即可将数据导入IoTDB,您可以使用这些数据来测试和执行示例中的SQL语句,并获得相应的结果。

示例 1:获取设备** **`100`** **某个时间范围的每小时平均温度

Expand Down