postgresql 命令行讀取sql

1.

C:\WINDOWS\system32>psql -U postgres -d postgres
psql (9.6.5)
"help" でヘルプを表示します.

postgres=# \encoding
SJIS
postgres=#
 

2.SJIS形式保存下面的語句

/*
テーブルの作成とデータの追加
2020/04/19
*/

--テーブルの作成
create table friends(id integer, name varchar(10));


--データの追加
insert into friends values(1,'Tom');
insert into friends values(2,'Jim');
insert into friends values(3,'Lily');

3.


C:\WINDOWS\system32>psql -U postgres -d postgres
psql (9.6.5)
"help" でヘルプを表示します.

postgres=# \i 'c:/tmp/test.sql'

 

 

 

4.

postgres=# select * from friends;

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章