记录今天的努力,为了明日的繁复!

Microsoft Windows [版本 10.0.22631.2428]
(c) Microsoft Corporation。保留所有权利。

C:\Windows\System32>C:\postgreSQL\9.5\bin\psql -U postgres -d product
用户 postgres 的口令:
psql: 致命错误:  数据库 "product" 不存在

C:\Windows\System32>C:\postgreSQL\9.5\bin\psql -U postgres -d Product
用户 postgres 的口令:
psql: 致命错误:  数据库 "Product" 不存在

C:\Windows\System32>C:\postgreSQL\9.5\bin\psql -U postgres
用户 postgres 的口令:
psql: 致命错误:  用户 "postgres" Password 认证失败

C:\Windows\System32>C:\postgreSQL\9.5\bin\psql -U postgres
用户 postgres 的口令:
psql (9.5.25)
输入 "help" 来获取帮助信息.

postgres=# CREATE TABLE Product
postgres-# (product_id CHAR(4) NOT NULL ,
postgres(# product_name VARCHAR(100) NOT NULL ,
postgres(# product_type VARCHAR(32) NOT NULL ,
postgres(# sale_price INTEGER ,
postgres(# purchase_price INTEGER ,
postgres(# regist_date DATE ,
postgres(# PRIMARY KEY (produce_id));
错误:  在键字中命名的字段 "produce_id" 不存在
第8PRIMARY KEY (produce_id));
     ^
postgres=# CREATE TABLE Product
postgres-# (product_id CHAR(4) NOT NULL ,
postgres(# product_name VARCHAR(100) NOT NULL ,
postgres(# product_type VARCHAR(32) NOT NULL ,
postgres(# sale_price INTEGER ,
postgres(# purchase_price INTEGER ,
postgres(# regist_date DATE ,
postgres(# PRIMARY KEY (product_id));
CREATE TABLE
postgres=# INSERT INTO Product VALUES ('0001','T恤衫','衣服',1000,500,'2009-09-20');
INSERT 0 1
postgres=# INSERT INTO Product VALUES ('0002','打孔器','办公用品',500,320,'2009-09-11');
INSERT 0 1
postgres=# INSERT INTO Product VALUES ('0003','运动T恤','衣服',4000,2800,NULL);
INSERT 0 1
postgres=# INSERT INTO Product VALUES ('0004','菜刀','厨房用具',3000,2800,'2009-09-20');
INSERT 0 1
postgres=# INSERT INTO Product VALUES ('0005','高压锅','厨房用具',6800,5000,'2009-01-15');
INSERT 0 1
postgres=# INSERT INTO Product VALUES ('0006','叉子','厨房用具',500,NULL,'2009-09-20');
INSERT 0 1
postgres=# INSERT INTO Product VALUES ('0007','擦菜板','厨房用具',880,790,'2008-04-28');
INSERT 0 1
postgres=# INSERT INTO Product VALUES ('0008','圆珠笔','办公用品',100,NULL,'2009-11-11');
INSERT 0 1
postgres=# COMMIT;
警告:  没有事物在运行中
COMMIT
postgres=# COMMIT;
警告:  没有事物在运行中
COMMIT
postgres=# COMMIT;
警告:  没有事物在运行中
COMMIT
postgres=# COMMIT
postgres-# \q

C:\Windows\System32>C:\postgreSQL\9.5\bin\psql -U postgres -d Product
用户 postgres 的口令:
psql: 致命错误:  数据库 "Product" 不存在

C:\Windows\System32>C:\postgreSQL\9.5\bin\psql -U postgres
用户 postgres 的口令:
psql (9.5.25)
输入 "help" 来获取帮助信息.

postgres=# CREATE TABLE Product
postgres-# BEGIN TRANSACTION;
错误:  语法错误 在 "BEGIN" 或附近的
第2BEGIN TRANSACTION;
     ^
postgres=#  CREATE TABLE Product
postgres-# postgres-# (product_id CHAR(4) NOT NULL ,
postgres(# postgres(# product_name VARCHAR(100) NOT NULL ,
postgres(# postgres(# product_type VARCHAR(32) NOT NULL ,
postgres(# postgres(# sale_price INTEGER ,
postgres(# postgres(# purchase_price INTEGER ,
postgres(# postgres(# regist_date DATE ,
postgres(# postgres(# PRIMARY KEY (product_id));
postgres(# CREATE TABLE
postgres(#
postgres(#
postgres(#
postgres(#
postgres(# \Q
无效的命令 \Q,用 \? 查看帮助。
postgres(# \q

C:\Windows\System32>C:\postgreSQL\9.5\bin\psql -U postgres
用户 postgres 的口令:
psql: 致命错误:  用户 "postgres" Password 认证失败

C:\Windows\System32>C:\postgreSQL\9.5\bin\psql -U postgres
用户 postgres 的口令:
psql (9.5.25)
输入 "help" 来获取帮助信息.

postgres=# CREATE TABLE Product
postgres-# postgres-# (product_id CHAR(4) NOT NULL ,
postgres(# postgres(# product_name VARCHAR(100) NOT NULL ,
postgres(#  p^Z^Z^Z\qostgres(# product_name VARCHAR(100) NOT NULL ,
\
无效的命令 \,用 \? 查看帮助。
postgres(# \q

C:\Windows\System32>C:\postgreSQL\9.5\bin\psql -U postgres
用户 postgres 的口令:
psql (9.5.25)
输入 "help" 来获取帮助信息.

postgres=# DROP TABLE Product;
DROP TABLE
postgres=# CREATE TABLE Product
postgres-# (product_id CHAR(4) NOT NULL ,
postgres(# product_name VARCHAR(100) NOT NULL ,
postgres(# product_type VARCHAR(32) NOT NULL ,
postgres(# sale_price INTEGER ,
postgres(# purchase_price INTEGER ,
postgres(# regist_date DATE ,
postgres(# PRIMARY KEY (product_id));
CREATE TABLE
postgres=# BEGIN TRANSACTION;
BEGIN
postgres=# INSERT INTO Product VALUES ('0001','T恤衫','衣服',1000,500,'2009-09-20');
INSERT 0 1
postgres=# INSERT INTO Product VALUES ('0002','打孔器','办公用品',500,320,'2009-09-11');
INSERT 0 1
postgres=# INSERT INTO Product VALUES ('0003','运动T恤','衣服',4000,2800,NULL);
INSERT 0 1
postgres=# INSERT INTO Product VALUES ('0004','菜刀','厨房用具',3000,2800,'2009-09-20');
INSERT 0 1
postgres=# INSERT INTO Product VALUES ('0005','高压锅','厨房用具',6800,5000,'2009-01-15');
INSERT 0 1
postgres=# INSERT INTO Product VALUES ('0006','叉子','厨房用具',500,NULL,'2009-09-20');
INSERT 0 1
postgres=# INSERT INTO Product VALUES ('0007','擦菜板','厨房用具',880,790,'2008-04-28');
INSERT 0 1
postgres=# INSERT INTO Product VALUES ('0008','圆珠笔','办公用品',100,NULL,'2009-11-11');
INSERT 0 1
postgres=# COMMIT;
COMMIT
postgres=# SELECT product_id,product_name,product_price
postgres-# FROM Product;
错误:  字段 "product_price" 不存在
第1SELECT product_id,product_name,product_price
                                    ^
postgres=# SELECT product_id,product_name,purchase_price
postgres-# From Product;
 product_id | product_name | purchase_price
------------+--------------+----------------
 0001       | T恤衫        |            500
 0002       | 打孔器       |            320
 0003       | 运动T恤      |           2800
 0004       | 菜刀         |           2800
 0005       | 高压锅       |           5000
 0006       | 叉子         |
 0007       | 擦菜板       |            790
 0008       | 圆珠笔       |
(8 行记录)


postgres=# SELECT *
postgres-# FROM Product;
 product_id | product_name | product_type | sale_price | purchase_price | regist_date
------------+--------------+--------------+------------+----------------+-------------
 0001       | T恤衫        | 衣服         |       1000 |            500 | 2009-09-20
 0002       | 打孔器       | 办公用品     |        500 |            320 | 2009-09-11
 0003       | 运动T恤      | 衣服         |       4000 |           2800 |
 0004       | 菜刀         | 厨房用具     |       3000 |           2800 | 2009-09-20
 0005       | 高压锅       | 厨房用具     |       6800 |           5000 | 2009-01-15
 0006       | 叉子         | 厨房用具     |        500 |                | 2009-09-20
 0007       | 擦菜板       | 厨房用具     |        880 |            790 | 2008-04-28
 0008       | 圆珠笔       | 办公用品     |        100 |                | 2009-11-11
(8 行记录)


postgres=# SELECT product_id AS id,product_name AS name,purchase_price AS price
postgres-# FROM Product;
  id  |  name   | price
------+---------+-------
 0001 | T恤衫   |   500
 0002 | 打孔器  |   320
 0003 | 运动T恤 |  2800
 0004 | 菜刀    |  2800
 0005 | 高压锅  |  5000
 0006 | 叉子    |
 0007 | 擦菜板  |   790
 0008 | 圆珠笔  |
(8 行记录)


postgres=# SELECT product_id AS "商品编号",product_name AS "商品名称",purchaase_price AS "进货价格"
postgres-# FROM Product;
错误:  语法错误 在 ",product_name" 或附近的
第1SELECT product_id AS "商品编号",product_name AS "商品名称",...
                                    ^
postgres=# SELECT product_id AS "商品编号",product_name AS "商品名称",purchaase_price AS "进货价格"
postgres-# FROM Product;
错误:  字段 "purchaase_price" 不存在
第1...oduct_id AS "商品编号",product_name AS "商品名称",purchaase_...
                                                          ^
提示:  也许您想要引用列"product.purchase_price"。
postgres=# SELECT product_id AS "商品编号",product_name AS "商品名称",purchase_price AS "进货价格"
postgres-# FROM Product;
 商品编号 | 商品名称 | 进货价格
----------+----------+----------
 0001     | T恤衫    |      500
 0002     | 打孔器   |      320
 0003     | 运动T恤  |     2800
 0004     | 菜刀     |     2800
 0005     | 高压锅   |     5000
 0006     | 叉子     |
 0007     | 擦菜板   |      790
 0008     | 圆珠笔   |
(8 行记录)


postgres=# SELECT '商品' AS string,38 AS number, '2009-02-24' AS date,
postgres-# product_id,product_name
postgres-# FROM Product;
 string | number |    date    | product_id | product_name
--------+--------+------------+------------+--------------
 商品   |     38 | 2009-02-24 | 0001       | T恤衫
 商品   |     38 | 2009-02-24 | 0002       | 打孔器
 商品   |     38 | 2009-02-24 | 0003       | 运动T恤
 商品   |     38 | 2009-02-24 | 0004       | 菜刀
 商品   |     38 | 2009-02-24 | 0005       | 高压锅
 商品   |     38 | 2009-02-24 | 0006       | 叉子
 商品   |     38 | 2009-02-24 | 0007       | 擦菜板
 商品   |     38 | 2009-02-24 | 0008       | 圆珠笔
(8 行记录)


postgres=#
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值