質問編集履歴

3

pgAdmin4の画面を追記しました。

2019/05/02 07:40

投稿

Maeterlinck
Maeterlinck

スコア13

title CHANGED
File without changes
body CHANGED
@@ -21,6 +21,8 @@
21
21
  今日いちにち悩んでおり、ぜひ経験豊かな方々のアドバイスをいただきたく思います。
22
22
 
23
23
  itemテーブルの構造は、sample_pg_sjis.sqlで以下のように指定しています。
24
+ また、postgreSQLの表示の画面も追加します。
25
+
24
26
  ```postgreSQL
25
27
 
26
28
  CREATE TABLE item
@@ -41,4 +43,68 @@
41
43
 
42
44
 
43
45
  コード
46
+ ```
47
+
48
+ ```postgreSQL
49
+ postgres=# \i ~/eclipse-workspace/Book/WebContent/sample_pg_sjis.sql
50
+ DROP DATABASE
51
+ psql:/Users/taishi/eclipse-workspace/Book/WebContent/sample_pg_sjis.sql:2: ERROR: current user cannot be dropped
52
+ psql:/Users/taishi/eclipse-workspace/Book/WebContent/sample_pg_sjis.sql:3: ERROR: role "postgres" already exists
53
+ CREATE DATABASE
54
+ You are now connected to database "sample" as user "postgres".
55
+ psql:/Users/taishi/eclipse-workspace/Book/WebContent/sample_pg_sjis.sql:7: NOTICE: table "item" does not exist, skipping
56
+ DROP TABLE
57
+ psql:/Users/taishi/eclipse-workspace/Book/WebContent/sample_pg_sjis.sql:19: ERROR: syntax error at or near "information"
58
+ LINE 10: information TEXT,
59
+ ^
60
+ psql:/Users/taishi/eclipse-workspace/Book/WebContent/sample_pg_sjis.sql:21: ERROR: relation "item" does not exist
61
+ LINE 1: INSERT INTO item(category_code, name, price, level, populari...
62
+ ^
63
+ psql:/Users/taishi/eclipse-workspace/Book/WebContent/sample_pg_sjis.sql:22: ERROR: relation "item" does not exist
64
+ LINE 1: INSERT INTO item(category_code, name, price, level, populari...
65
+ ^
66
+ psql:/Users/taishi/eclipse-workspace/Book/WebContent/sample_pg_sjis.sql:23: ERROR: relation "item" does not exist
67
+ LINE 1: INSERT INTO item(category_code, name, price, level, populari...
68
+ ^
69
+ psql:/Users/taishi/eclipse-workspace/Book/WebContent/sample_pg_sjis.sql:27: ERROR: relation "item" does not exist
70
+ LINE 1: INSERT INTO item(category_code, name, price, level, populari...
71
+ ^
72
+ psql:/Users/taishi/eclipse-workspace/Book/WebContent/sample_pg_sjis.sql:28: ERROR: relation "item" does not exist
73
+ LINE 1: INSERT INTO item(category_code, name, price, level, populari...
74
+ ^
75
+ psql:/Users/taishi/eclipse-workspace/Book/WebContent/sample_pg_sjis.sql:29: ERROR: relation "item" does not exist
76
+ LINE 1: INSERT INTO item(category_code, name, price, level, populari...
77
+ ^
78
+ psql:/Users/taishi/eclipse-workspace/Book/WebContent/sample_pg_sjis.sql:32: ERROR: relation "item" does not exist
79
+ LINE 1: INSERT INTO item(category_code, name, price, level, populari...
80
+ ^
81
+ psql:/Users/taishi/eclipse-workspace/Book/WebContent/sample_pg_sjis.sql:33: ERROR: relation "item" does not exist
82
+ LINE 1: INSERT INTO item(category_code, name, price, level, populari...
83
+ ^
84
+ psql:/Users/taishi/eclipse-workspace/Book/WebContent/sample_pg_sjis.sql:34: ERROR: relation "item" does not exist
85
+ LINE 1: INSERT INTO item(category_code, name, price, level, populari...
86
+ ^
87
+ psql:/Users/taishi/eclipse-workspace/Book/WebContent/sample_pg_sjis.sql:42: NOTICE: table "category" does not exist, skipping
88
+ DROP TABLE
89
+ CREATE TABLE
90
+ INSERT 0 1
91
+ INSERT 0 1
92
+ INSERT 0 1
93
+ psql:/Users/taishi/eclipse-workspace/Book/WebContent/sample_pg_sjis.sql:60: NOTICE: table "customer" does not exist, skipping
94
+ DROP TABLE
95
+ CREATE TABLE
96
+ psql:/Users/taishi/eclipse-workspace/Book/WebContent/sample_pg_sjis.sql:74: NOTICE: table "ordered" does not exist, skipping
97
+ DROP TABLE
98
+ CREATE TABLE
99
+ psql:/Users/taishi/eclipse-workspace/Book/WebContent/sample_pg_sjis.sql:88: NOTICE: table "ordered_detail" does not exist, skipping
100
+ DROP TABLE
101
+ CREATE TABLE
102
+ GRANT
103
+ psql:/Users/taishi/eclipse-workspace/Book/WebContent/sample_pg_sjis.sql:101: ERROR: relation "item" does not exist
104
+ ALTER TABLE
105
+ ALTER TABLE
106
+ ALTER TABLE
107
+ ALTER TABLE
108
+
109
+ コード
44
110
  ```

2

itemテーブルの構造について、加筆しました。よろしくお願いします。

2019/05/02 07:40

投稿

Maeterlinck
Maeterlinck

スコア13

title CHANGED
File without changes
body CHANGED
File without changes

1

itemテーブルの構造について、加筆しました。よろしくお願いします。

2019/05/02 07:37

投稿

Maeterlinck
Maeterlinck

スコア13

title CHANGED
File without changes
body CHANGED
@@ -18,4 +18,27 @@
18
18
  と表示されるばかりです。
19
19
 
20
20
  どうしたら良いでしょうか。
21
- 今日いちにち悩んでおり、ぜひ経験豊かな方々のアドバイスをいただきたく思います。
21
+ 今日いちにち悩んでおり、ぜひ経験豊かな方々のアドバイスをいただきたく思います。
22
+
23
+ itemテーブルの構造は、sample_pg_sjis.sqlで以下のように指定しています。
24
+ ```postgreSQL
25
+
26
+ CREATE TABLE item
27
+ (
28
+ code SERIAL PRIMARY KEY,
29
+ category_code INTEGER ,
30
+ name TEXT,
31
+ price INTEGER,
32
+ level INTEGER,
33
+ popularity INTEGER,
34
+ image TEXT
35
+ information TEXT,
36
+ );
37
+
38
+ INSERT INTO item(category_code, name, price, level, popularity, image, information) VALUES(1, 'スッキリわかるJava入門 第2版', 2808, 1, 3, 'スッキリわかるJava入門 第2版.jpg', 'プログラミング学習のネックとなる「開発環境の準備」と「多発するエラーへの対応」には、ブラウザ上でコーディング、コンパイル、実行ができる仮想開発環境「dokojava」を読者特典として用意し、エラーによく効く「虎の巻」を巻末付録として用意しました。本書でぜひ、Javaプロフェッショナルへの第一歩を踏みだしてください! ');
39
+ INSERT INTO item(category_code, name, price, level, popularity, image, information) VALUES(1, 'やさしいJava 第7版', 2786, 1, 2, 'やさしいJava.jpg', '文法の基礎からクラス、オブジェクト指向まで、しっかりと理解できる構成で、無理なく読み進められる書籍です。わかりやすく、読みやすい解説と、動かして理解できる多数のサンプルプログラムで、大切な基本がきちんと身につきます。最新のJava環境であるJava 11に対応し、OpenJDKを使った環境構築も紹介しています。');
40
+ INSERT INTO item(category_code, name, price, level, popularity, image, information) VALUES(1, 'Javaの教科書', 2160, 2, 2, 'Javaの教科書.jpg', '「Java」は、スタンドアロンやネットワーククライアント環境をはじめ、サーバサイド、あるいはモバイル環境にいたるまでのアプリケーションの開発に利用されるようになりました。本書は、これら開発のすべてに共通して必要な、プログラムの制御構造とアルゴリズムを学びながらJava言語の文法を習得する流れになっています。');
41
+
42
+
43
+ コード
44
+ ```