- Mastering PostgreSQL 10
- Hans Jürgen Sch?nig
- 160字
- 2021-06-30 19:04:01
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/downloads.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 https://www.cybertec-postgresql.com/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 between 1965 and 2010, for 14 nations 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)
推薦閱讀
- Google Cloud Platform Cookbook
- 高性能混合信號ARM:ADuC7xxx原理與應用開發
- 程序設計語言與編譯
- Getting Started with Containerization
- 人工智能工程化:應用落地與中臺構建
- 人工智能與人工生命
- 大數據平臺異常檢測分析系統的若干關鍵技術研究
- 數據庫系統原理及應用教程(第5版)
- Deep Reinforcement Learning Hands-On
- 網中之我:何明升網絡社會論稿
- Containers in OpenStack
- 工業自動化技術實訓指導
- Linux Shell Scripting Cookbook(Third Edition)
- 數據清洗
- Mastering Android Game Development with Unity