2010-04-06 178 views

回答

1

有可作爲pgFoundry項目數量樣本數據庫在http://pgfoundry.org/projects/dbsamples/

+0

的dbsamples頁被刪除psql的命令獲得羅斯文數據庫創建腳本。哪裏? – 42n4 2015-04-28 09:48:27

+0

是的,頁面不再存在了 – Fra 2016-04-04 17:37:58

8

我能夠從

http://www.antepedia.com/detail/p/48023267.html

專門

下載(PostgreSQL的)Northwind數據庫已廢棄: http://northwindextended.googlecode.com/files/northwind.postgre.sql]

[更新時間:Oct 2016] https://code.google.com/archive/p/northwindextended/downloads

加載/訪問數據庫:

sudo -u postgres psql  ## or: sudo su postgres 

postgres=# \i northwind.postgre.sql; 

postgres=# \d 
       List of relations 
Schema |   Name   | Type | Owner 
--------+----------------------+-------+---------- 
public | categories   | table | postgres 
public | customercustomerdemo | table | postgres 
public | customerdemographics | table | postgres 
public | customers   | table | postgres 
public | employees   | table | postgres 
public | employeeterritories | table | postgres 
public | order_details  | table | postgres 
public | orders    | table | postgres 
public | products    | table | postgres 
public | region    | table | postgres 
public | shippers    | table | postgres 
public | shippers_tmp   | table | postgres 
public | suppliers   | table | postgres 
public | territories   | table | postgres 
public | usstates    | table | postgres 
(15 rows) 

postgres=# \d customers; 
      Table "public.customers" 
    Column |   Type   | Modifiers 
--------------+-----------------------+----------- 
CustomerID | bpchar    | not null 
CompanyName | character varying(40) | not null 
ContactName | character varying(30) | 
ContactTitle | character varying(30) | 
Address  | character varying(60) | 
City   | character varying(15) | 
Region  | character varying(15) | 
PostalCode | character varying(10) | 
Country  | character varying(15) | 
Phone  | character varying(24) | 
Fax   | character varying(24) | 
Indexes: 
    "pk_customers" PRIMARY KEY, btree ("CustomerID") 

# Note the following query error: 

postgres=# SELECT DISTINCT City FROM customers ORDER BY City; 
ERROR: column "city" does not exist 
LINE 1: SELECT DISTINCT City FROM customers ORDER BY City; 
         ^

# ... use use double-quotes if your column name 
# (etc.) contains some uppercase characters: 

postgres=# SELECT DISTINCT "City" FROM customers ORDER BY "City"; 
     City  
----------------- 
Aachen 
Albuquerque 
Anchorage 
Århus 
Barcelona 
[ ... snip! ... ] 
Tsawassen 
Vancouver 
Versailles 
Walla Walla 
Warszawa 

該數據庫使用(例如)在這個優秀的在線教程(我跳過前面幾頁,第一頁是提到它):

http://www.w3schools.com/sql/sql_syntax.asp

4

另外兩個答案似乎已過時。

您可以從this link

運行查詢使用PG管理員或