次のテーブルを使用します。
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 |