例 - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL関数、式、および述部

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
2021年7月
Language
日本語
Last Update
2021-09-23
dita:mapPath
ja-JP/djk1612415574830.ditamap
dita:ditavalPath
ja-JP/wrg1590696035526.ditaval
dita:id
B035-1145
Product Category
Software
Teradata Vantage

次のテーブルを使用します。

Area Address Price
Downtown 72 Easy Street 509000
Downtown 29 Right Way 402000
Downtown 45 Diamond Lane 203000
Downtown 76 Blind Alley 201000
Downtown 15 Tern Pike 199000
Downtown 444 Kanga Road 102000
Uptown 15 Peak Street 456000
Uptown 27 Primrose Path 349000
Uptown 44 Shady Lane 341000
Uptown 34 Design Road 244000
Uptown 2331 Highway 64 244000
Uptown 77 Sunset Strip 102000

次のSQL文は、その直後のテーブルに指定されたとおりに、線形補間の実施後に計算結果を返します。

SELECT area,
       AVG(price),
       PERCENTILE_DISC(0.5) WITHIN GROUP (ORDER BY price),
       PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY price)
FROM market
GROUP BY area;
Area Average Price PERC_DISC PERC_CONT
Downtown 269333 201000 202000
Uptown 289333 244000 292500