Function: the value of the specified column below which `P` percent of the data points fall.
Function: the value of the specified column below which `P` percent of the data points fall.
Return Data Type: the same data type.
Return Data Type: double.
Applicable Data Types: all types except `timestamp`, `binary`, `nchar`, `bool`.
Applicable Data Types: all types except `timestamp`, `binary`, `nchar`, `bool`.
Applied to: table/STable.
Applied to: table/STable.
Note: The range of `P` is `[0, 100]`. When `P=0` , `PERCENTILE` returns the equal value as `MIN`; when `P=100`, `PERCENTILE` returns the equal value as `MAX`.
Note: The range of `P` is `[0, 100]`. When `P=0` , `PERCENTILE` returns the equal value as `MIN`; when `P=100`, `PERCENTILE` returns the equal value as `MAX`.
...
@@ -446,7 +446,7 @@ TDengine supports aggregations over numerical values, they are listed below:
...
@@ -446,7 +446,7 @@ TDengine supports aggregations over numerical values, they are listed below:
SELECT SPREAD(field_name) FROM { tb_name | stb_name } [WHERE clause]
SELECT SPREAD(field_name) FROM { tb_name | stb_name } [WHERE clause]
```
```
Function: return the difference between the maximum and the mimimum value.
Function: return the difference between the maximum and the mimimum value.
Return Data Type: the same data type.
Return Data Type: double.
Applicable Data Types: all types except `timestamp`, `binary`, `nchar`, `bool`.
Applicable Data Types: all types except `timestamp`, `binary`, `nchar`, `bool`.
Applied to: table/STable.
Applied to: table/STable.
Note: spread gives the range of data variation in a table/supertable; it is equivalent to `MAX()` - `MIN()`
Note: spread gives the range of data variation in a table/supertable; it is equivalent to `MAX()` - `MIN()`
"insert into tb2 using stb1 tags(2,'tb2', '表2') values ('2020-04-18 15:00:02.000', 3, 2.1), ('2020-04-18 15:00:03.000', 4, 2.2)")
"insert into tb2 using stb1 tags(2,'tb2', '表2') values ('2020-04-18 15:00:02.000', 3, 2.1), ('2020-04-18 15:00:03.000', 4, 2.2)")
# inner join --- bug
# inner join --- bug
tdSql.query("select * from tb1 a, tb2 b where a.ts = b.ts")
tdSql.error("select * from tb1 a, tb2 b where a.ts = b.ts")
tdSql.checkRows(1)
# join 3 tables -- bug exists
# join 3 tables -- bug exists
tdSql.query("select stb_t.ts, stb_t.dscrption, stb_t.temperature, stb_p.id, stb_p.dscrption, stb_p.pressure,stb_v.velocity from stb_p, stb_t, stb_v where stb_p.ts=stb_t.ts and stb_p.ts=stb_v.ts and stb_p.id = stb_t.id")
tdSql.error("select stb_t.ts, stb_t.dscrption, stb_t.temperature, stb_p.id, stb_p.dscrption, stb_p.pressure,stb_v.velocity from stb_p, stb_t, stb_v where stb_p.ts=stb_t.ts and stb_p.ts=stb_v.ts and stb_p.id = stb_t.id")
# query show stable
# query show stable
tdSql.query("show stables")
tdSql.query("show stables")
tdSql.checkRows(1)
tdSql.checkRows(1)
# query show tables
# query show tables
tdSql.query("show table")
tdSql.query("show tables")
tdSql.checkRows(2)
tdSql.checkRows(2)
# query count
# query count
...
@@ -71,16 +70,13 @@ class TDTestCase:
...
@@ -71,16 +70,13 @@ class TDTestCase:
tdSql.checkRows(2)
tdSql.checkRows(2)
# query first ... as
# query first ... as
tdSql.query("select first(*) as begin from stb1")
tdSql.error("select first(*) as begin from stb1")
tdSql.checkData(0,1,1)
# query last ... as
# query last ... as
tdSql.query("select last(*) as end from stb1")
tdSql.error("select last(*) as end from stb1")
tdSql.checkData(0,1,4)
# query last_row ... as
# query last_row ... as
tdSql.query("select last_row(*) as end from stb1")
tdSql.error("select last_row(*) as end from stb1")
tdSql.checkData(0,1,4)
# query group .. by
# query group .. by
tdSql.query("select sum(c1), t2 from stb1 group by t2")
tdSql.query("select sum(c1), t2 from stb1 group by t2")