質問編集履歴
3
編集
test
CHANGED
File without changes
|
test
CHANGED
@@ -46,9 +46,7 @@
|
|
46
46
|
|
47
47
|
create table classtimes (
|
48
48
|
|
49
|
-
classtime_id int primary key auto_increment,
|
50
|
-
|
51
|
-
classtime_
|
49
|
+
classtime_id int,
|
52
50
|
|
53
51
|
id int,
|
54
52
|
|
@@ -62,41 +60,29 @@
|
|
62
60
|
|
63
61
|
|
64
62
|
|
65
|
-
insert into classtimes (classtime_
|
63
|
+
insert into classtimes (id,classtime_id,weekday_id) values (1,1,1);
|
66
64
|
|
67
|
-
insert into classtimes (classtime_
|
65
|
+
insert into classtimes (id,classtime_id,weekday_id) values (1,2,1);
|
68
66
|
|
69
|
-
insert into classtimes (classtime_
|
67
|
+
insert into classtimes (id,classtime_id,weekday_id) values (1,3,1);
|
70
68
|
|
71
|
-
insert into classtimes (classtime_
|
69
|
+
insert into classtimes (id,classtime_id,weekday_id) values (2,1,2);
|
72
70
|
|
73
|
-
insert into classtimes (classtime_
|
71
|
+
insert into classtimes (id,classtime_id,weekday_id) values (2,2,2);
|
74
72
|
|
75
|
-
insert into classtimes (classtime_
|
73
|
+
insert into classtimes (id,classtime_id,weekday_id) values (2,3,2);
|
76
74
|
|
77
|
-
insert into classtimes (classtime_
|
75
|
+
insert into classtimes (id,classtime_id,weekday_id) values (2,1,3);
|
78
76
|
|
79
|
-
insert into classtimes (classtime_
|
77
|
+
insert into classtimes (id,classtime_id,weekday_id) values (2,2,3);
|
80
78
|
|
81
|
-
insert into classtimes (classtime_name,weekday_id) values (4,2);
|
82
|
-
|
83
|
-
insert into classtimes (classtime_name,weekday_id) values (5,2);
|
84
|
-
|
85
|
-
insert into classtimes (classtime_name,weekday_id) values (1,3);
|
86
|
-
|
87
|
-
insert into classtimes (classtime_
|
79
|
+
insert into classtimes (id,classtime_id,weekday_id) values (2,3,3);
|
88
|
-
|
89
|
-
insert into classtimes (classtime_name,weekday_id) values (3,3);
|
90
|
-
|
91
|
-
insert into classtimes (classtime_name,weekday_id) values (4,3);
|
92
|
-
|
93
|
-
insert into classtimes (classtime_name,weekday_id) values (5,3);
|
94
80
|
|
95
81
|
```
|
96
82
|
|
97
83
|
|
98
84
|
|
99
|
-
下記のsql文を書きましたが、
|
85
|
+
下記のsql文を書きましたが、
|
100
86
|
|
101
87
|
|
102
88
|
|
@@ -114,13 +100,35 @@
|
|
114
100
|
|
115
101
|
|
116
102
|
|
103
|
+
下記のようにエラーが発生してしまいます。
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
```lang-sql
|
108
|
+
|
109
|
+
+------+
|
110
|
+
|
111
|
+
| name |
|
112
|
+
|
113
|
+
+------+
|
114
|
+
|
115
|
+
| Math |
|
116
|
+
|
117
|
+
| Math |
|
118
|
+
|
119
|
+
| Math |
|
120
|
+
|
121
|
+
+------+
|
122
|
+
|
123
|
+
```
|
124
|
+
|
125
|
+
|
126
|
+
|
117
127
|
うまく出力されない理由として、
|
118
128
|
|
119
129
|
|
120
130
|
|
121
131
|
・classtimeテーブルのinsert文がおかしい
|
122
|
-
|
123
|
-
・classtimeテーブルとweekdaysテーブルの間に中間テーブルを設定しなければならない?
|
124
132
|
|
125
133
|
|
126
134
|
|
2
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -19,6 +19,28 @@
|
|
19
19
|
insert into classes (id,name) values (1,'IT');
|
20
20
|
|
21
21
|
insert into classes (id,name) values (2,'Math');
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
create table weekdays (
|
26
|
+
|
27
|
+
weekday_id int primary key auto_increment,
|
28
|
+
|
29
|
+
weekday_name text,
|
30
|
+
|
31
|
+
id int,
|
32
|
+
|
33
|
+
foreign key (id) references classes (id)
|
34
|
+
|
35
|
+
);
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
insert into weekdays (weekday_id,weekday_name) values (1,'Sunday');
|
40
|
+
|
41
|
+
insert into weekdays (weekday_id,weekday_name) values (2,'Monday');
|
42
|
+
|
43
|
+
insert into weekdays (weekday_id,weekday_name) values (3,'Tuesday');
|
22
44
|
|
23
45
|
|
24
46
|
|
@@ -70,33 +92,11 @@
|
|
70
92
|
|
71
93
|
insert into classtimes (classtime_name,weekday_id) values (5,3);
|
72
94
|
|
73
|
-
|
74
|
-
|
75
|
-
create table weekdays (
|
76
|
-
|
77
|
-
weekday_id int primary key auto_increment,
|
78
|
-
|
79
|
-
weekday_name text,
|
80
|
-
|
81
|
-
id int,
|
82
|
-
|
83
|
-
foreign key (id) references classes (id)
|
84
|
-
|
85
|
-
);
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
insert into weekdays (weekday_id,weekday_name) values (1,'Sunday');
|
90
|
-
|
91
|
-
insert into weekdays (weekday_id,weekday_name) values (2,'Monday');
|
92
|
-
|
93
|
-
insert into weekdays (weekday_id,weekday_name) values (3,'Tuesday');
|
94
|
-
|
95
95
|
```
|
96
96
|
|
97
97
|
|
98
98
|
|
99
|
-
下記のsql文を書きましたが、
|
99
|
+
下記のsql文を書きましたが、Empty set と表示されてしまいます。
|
100
100
|
|
101
101
|
|
102
102
|
|
@@ -129,3 +129,15 @@
|
|
129
129
|
|
130
130
|
|
131
131
|
よろしくお願いお願いいたします。
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
=======
|
138
|
+
|
139
|
+
修正:
|
140
|
+
|
141
|
+
weekdaysテーブルとclasstimesテーブルの順番がおかしかったので訂正しました。
|
142
|
+
|
143
|
+
エラー内容はEmpty setです。
|
1
追加
test
CHANGED
File without changes
|
test
CHANGED
File without changes
|