teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

create文の追記

2018/05/18 11:19

投稿

wakahiro
wakahiro

スコア20

title CHANGED
File without changes
body CHANGED
@@ -170,4 +170,51 @@
170
170
  ```
171
171
  長々と読んでいただき本当にありがとうございます。
172
172
 
173
- お手数ですが、よろしくお願いします。
173
+ お手数ですが、よろしくお願いします。
174
+
175
+ 追記create形式
176
+
177
+ ```SQL
178
+ MariaDB [test]> create table user(
179
+ -> id int unsigned not null auto_increment,
180
+ -> name varchar(50),
181
+ -> old int unsigned,
182
+ -> primary key (id)
183
+ -> ) engine=InnoDB;
184
+ Query OK, 0 rows affected (0.11 sec)
185
+
186
+ MariaDB [test]> create table plan(
187
+ -> id int unsigned not null auto_increment,
188
+ -> name varchar(50),
189
+ -> main_time int unsigned,
190
+ -> primary key (id)
191
+ -> ) engine=InnoDB;
192
+ Query OK, 0 rows affected (0.01 sec)
193
+
194
+ MariaDB [test]> create table play_task(
195
+ -> id int unsigned not null auto_increment,
196
+ -> play_day date,
197
+ -> user_id int unsigned ,
198
+ -> plan_id int unsigned ,
199
+ -> primary key (id),
200
+ -> foreign key(user_id) references user(id)
201
+ -> on update cascade on delete cascade ,
202
+ -> foreign key(plan_id) references plan(id)
203
+ -> on update cascade on delete cascade
204
+ -> ) engine=InnoDB;
205
+ Query OK, 0 rows affected (0.01 sec)
206
+
207
+ MariaDB [test]> create table amount_day(
208
+ -> id int unsigned not null auto_increment,
209
+ -> amount_day date,
210
+ -> APLAN int unsigned ,
211
+ -> APLANcount int unsigned ,
212
+ -> BPLAN int unsigned ,
213
+ -> BPLANcount int unsigned ,
214
+ -> CPLAN int unsigned ,
215
+ -> CPLANcmount int unsigned ,
216
+ -> primary key (id)
217
+ ->
218
+ -> ) engine=InnoDB;
219
+ Query OK, 0 rows affected (0.01 sec)
220
+ ```