- Mastering PostgreSQL 9.6
- Hans Jurgen Schonig
- 163字
- 2021-07-09 19:57:24
Loading some sample data
To make this chapter a pleasant experience for you, I have compiled some sample data, which has been taken from the BP energy report: http://www.bp.com/en/global/corporate/energy-economics/statistical-review-of-world-energy.html.
Here is the data structure that will be used:
test=# CREATE TABLE t_oil (
region text,
country text,
year int,
production int,
consumption int
);
CREATE TABLE
The test data can be downloaded from our website using curl directly:
test=# COPY t_oil FROM PROGRAM ' curl www.cybertec.at/secret/oil_ext.txt ';
COPY 644
As in the previous chapter, you can download the file before importing it. On some operating systems, curl is not there by default or has not been installed, so downloading the file before might be an easier option for many people.
There is data for 14 nations between 1965 and 2010, which are in two regions of the world:
test=# SELECT region, avg(production) FROM t_oil GROUP BY region;
region | avg
---------------+-----------------------
Middle East | 1992.6036866359447005
North America | 4541.3623188405797101
(2 rows)
推薦閱讀
- 基于LabWindows/CVI的虛擬儀器設計與應用
- PostgreSQL Administration Essentials
- Multimedia Programming with Pure Data
- 完全掌握AutoCAD 2008中文版:綜合篇
- INSTANT Heat Maps in R:How-to
- 基于神經網絡的監督和半監督學習方法與遙感圖像智能解譯
- 深度學習與目標檢測
- Salesforce Advanced Administrator Certification Guide
- Photoshop CS4數碼照片處理入門、進階與提高
- Data Analysis with R(Second Edition)
- Redash v5 Quick Start Guide
- Mastering SQL Server 2014 Data Mining
- Hands-On Generative Adversarial Networks with Keras
- 玩轉機器人:基于Proteus的電路原理仿真(移動視頻版)
- Intel Edison Projects