質問編集履歴
2
結果画面の追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
SQL文に示すように、dept_idで二つのテーブルを内部結合しています。
|
4
4
|
|
5
|
+
![イメージ説明](996a3feb2c6347322da4ae73441df65d.png)
|
6
|
+
|
5
7
|
|
6
8
|
|
7
9
|
```SQL
|
1
SQL文の修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -8,94 +8,80 @@
|
|
8
8
|
|
9
9
|
-- ユーザーの作成・権限付与
|
10
10
|
|
11
|
-
CREATE USER
|
11
|
+
CREATE USER servlet_training_user IDENTIFIED BY systemsss;
|
12
|
-
|
12
|
+
|
13
|
-
GRANT ALL PRIVILEGES TO
|
13
|
+
GRANT ALL PRIVILEGES TO servlet_training_user;
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
14
|
+
|
15
|
+
|
16
|
+
|
19
|
-
--
|
17
|
+
-- 部署テーブルの作成
|
20
|
-
|
18
|
+
|
21
|
-
CREATE TABLE
|
19
|
+
CREATE TABLE department (
|
22
|
-
|
20
|
+
|
23
|
-
|
21
|
+
dept_id NUMBER(2) PRIMARY KEY,
|
24
|
-
|
22
|
+
|
25
|
-
|
23
|
+
dept_name VARCHAR2(15 CHAR) NOT NULL
|
26
24
|
|
27
25
|
);
|
28
26
|
|
29
27
|
|
30
28
|
|
31
|
-
--
|
29
|
+
-- 社員テーブルの作成
|
32
|
-
|
30
|
+
|
33
|
-
CREATE TABLE
|
31
|
+
CREATE TABLE employee (
|
34
|
-
|
32
|
+
|
35
|
-
|
33
|
+
emp_id NUMBER(5) PRIMARY KEY,
|
34
|
+
|
36
|
-
|
35
|
+
emp_pass VARCHAR2(16 CHAR) NOT NULL,
|
36
|
+
|
37
|
-
|
37
|
+
emp_name VARCHAR2(30 CHAR) NOT NULL,
|
38
|
+
|
38
|
-
|
39
|
+
gender NUMBER(1) NOT NULL,
|
40
|
+
|
39
|
-
a
|
41
|
+
address VARCHAR(60 CHAR) NOT NULL,
|
40
|
-
|
42
|
+
|
41
|
-
|
43
|
+
birthday DATE NOT NULL,
|
42
|
-
|
44
|
+
|
43
|
-
|
45
|
+
authority NUMBER(1) NOT NULL,
|
44
|
-
|
46
|
+
|
45
|
-
|
47
|
+
dept_id NUMBER(2) NOT NULL REFERENCES department(dept_id)
|
46
48
|
|
47
49
|
);
|
48
50
|
|
49
51
|
|
50
52
|
|
51
|
-
--
|
53
|
+
-- シーケンスの作成
|
52
|
-
|
54
|
+
|
53
|
-
CREATE
|
55
|
+
CREATE SEQUENCE seq_emp NOCACHE;;
|
54
|
-
|
55
|
-
|
56
|
+
|
56
|
-
|
57
|
-
|
57
|
+
|
58
|
-
|
59
|
-
|
58
|
+
|
60
|
-
|
61
|
-
|
59
|
+
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
60
|
+
|
67
|
-
--
|
61
|
+
-- 部署テーブルへのレコード登録
|
68
|
-
|
62
|
+
|
69
|
-
INSERT INTO
|
63
|
+
INSERT INTO department VALUES(1, '営業部');
|
70
|
-
|
64
|
+
|
71
|
-
INSERT INTO
|
65
|
+
INSERT INTO department VALUES(2, '経理部');
|
72
|
-
|
66
|
+
|
73
|
-
INSERT INTO
|
67
|
+
INSERT INTO department VALUES(3, '総務部');
|
74
|
-
|
75
|
-
|
76
|
-
|
68
|
+
|
69
|
+
|
70
|
+
|
77
|
-
--
|
71
|
+
-- 社員テーブルへのレコード登録
|
78
|
-
|
79
|
-
|
72
|
+
|
80
|
-
|
81
|
-
INSERT INTO
|
73
|
+
INSERT INTO employee VALUES(seq_emp.nextval,'1111','鈴木太郎',1,'東京都','1986/10/12',1,1);
|
82
|
-
|
74
|
+
|
83
|
-
INSERT INTO
|
75
|
+
INSERT INTO employee VALUES(seq_emp.nextval,'2222','田中二郎',1,'千葉県','1979/07/02',2,2);
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
76
|
+
|
88
|
-
|
89
|
-
INSERT INTO book_user VALUES(1, '鈴木太郎', 1111);
|
90
|
-
|
91
|
-
INSERT INTO
|
77
|
+
INSERT INTO employee VALUES(seq_emp.nextval,'3333','渡辺花子',2,'大阪府','1988/04/23',2,2);
|
92
|
-
|
93
|
-
|
94
78
|
|
95
79
|
|
96
80
|
|
97
81
|
COMMIT;
|
98
82
|
|
83
|
+
|
84
|
+
|
99
85
|
```
|
100
86
|
|
101
87
|
```servlet
|