目前共有4篇帖子。 內容轉換:不轉換▼
 
點擊 回復
349 3
【PostgreSQL】PSQL基本操作
准尉 十一級
1樓 發表于:2011-7-16 08:50
$ sudo su postgres
切换到postgres用户
postgres@phpServer:/home/octopus$ createdb mydb
创建数据库mydb
postgres@phpServer:/home/octopus$ psql mydb
打开psql命令行
准尉 十一級
2樓 發表于:2011-7-16 08:51
\l 查看所有数据库
\dt 查看当前数据库中的所有数据表
\d 表名 查看某个表的结构
准尉 十一級
3樓 發表于:2011-7-16 08:51
输入\l后可以输入\q退出
准尉 十一級
4樓 發表于:2011-7-16 08:52
mydb=# \dt
                关联列表
 架构模式 |   名称   |  型别  |  拥有者  
----------+----------+--------+----------
 public   | cities   | 资料表 | postgres
 public   | products | 资料表 | postgres
 public   | weather  | 资料表 | postgres
(3 行记录)

mydb=# \d weather
         资料表 "public.weather"
  栏位   |         型别          | 修饰词
---------+-----------------------+--------
 city    | character varying(80) |
 temp_lo | integer               |
 temp_hi | integer               |
 prcp    | real                  |
 date    | date                  |

回復帖子

內容:
用戶名: 您目前是匿名發表
驗證碼:
(快捷鍵:Ctrl+Enter)
 

本帖信息

點擊數:349 回複數:3
評論數: ?
作者: 魔法绿骑士
最後回復:魔法绿骑士
最後回復時間:2011-7-16 08:52
 
©2010-2024 Arslanbar Ver2.0
除非另有聲明,本站採用創用CC姓名標示-相同方式分享 3.0 Unported許可協議進行許可。