author: takhisis@smth
http://computer.mblogger.cn/abyss/
一定要讓自己忙起來什麼也不想, 什麼也不要想, 不要想...不準想.
About PostgreSQL
PostgreSQL is an object-relational database management system (ORDBMS) based on POSTGRES, Version 4.2, developed at the University of California at Berkeley Computer Science Department. POSTGRES pioneered many concepts that only became available in some commercial database systems much later.
PostgreSQL is an open-source descendant of this original Berkeley code. It supports SQL92 and SQL99 and offers many modern features.
PostgreSQL首頁
http://www.postgresql.org/
下面的敘述所針對的cygwin及postgresql版本:
$ cygcheck -cd cygwin postgresqlCygwin Package InformationPackage Versioncygwin 1.5.10-3postgresql 7.4.3-1
從postgresql 7.4.2-1開始, cygwin使用cygserver來支援它而不是從前的cygipc.
cygserver的配置 產生/etc/cygserver.conf
/usr/bin/cygserver-config
設定環境變數
Please keep in mind, that a client application which wants to use the services provided by cygserver *must* have the environment variable CYGWIN set so that it contains the word "server". So, if you don't need any other special CYGWIN setting, just set it to "server".
It is advisable to add this setting to the Windows system environment.
export CYGWIN=server
啟動cygserver
/usr/sbin/cygserver &
postgresql的配置 postgresql的初始化
initdb -D $data_dir
啟動postgresql
注意使用-i開啟tcp連接埠
postmaster -i -D $data_dir &
啟動psql
psql template1
建立資料庫及表
$ createdb --encoding=EUC_CN cn_testCREATE DATABASE$ psql cn_testWelcome to psql 7.4.3, the PostgreSQL interactive terminal.Type: /copyright for distribution terms /h for help with SQL commands /? for help on internal slash commands /g or terminate with semicolon to execute query /q to quitcn_test=# /l List of databases Name | Owner | Encoding-----------+--------+----------- cn_test | $user | EUC_CN template0 | $user | SQL_ASCII template1 | $user | SQL_ASCII(3 rows)cn_test=# create table students (cn_test(# id int,cn_test(# name char(30)cn_test(# );CREATE TABLEcn_test=# /dt List of relations Schema | Name | Type | Owner--------+----------+-------+-------- public | students | table | $user(1 row)cn_test=# /d students Table "public.students" Column | Type | Modifiers--------+---------------+----------- id | integer | name | character(30) |cn_test=# insert into students values (cn_test(# 1,cn_test(# '呵呵'cn_test(# );INSERT 25337 1cn_test=# select * from students ; id | name----+---------------------------------- 1 | 呵呵(1 row)cn_test=# /q
Databases (DBs) and SQL with PostgreSQL
這個地方對sql初學者很適合的樣子
http://www.felixgers.de/teaching/sql/index.html
不過其實postgresql內建的文檔也蠻詳細的了...至少在基本的使用方面.