質問編集履歴

1

create文の追記

2018/05/18 11:19

投稿

wakahiro
wakahiro

スコア20

test CHANGED
File without changes
test CHANGED
@@ -343,3 +343,97 @@
343
343
 
344
344
 
345
345
  お手数ですが、よろしくお願いします。
346
+
347
+
348
+
349
+ 追記create形式
350
+
351
+
352
+
353
+ ```SQL
354
+
355
+ MariaDB [test]> create table user(
356
+
357
+ -> id int unsigned not null auto_increment,
358
+
359
+ -> name varchar(50),
360
+
361
+ -> old int unsigned,
362
+
363
+ -> primary key (id)
364
+
365
+ -> ) engine=InnoDB;
366
+
367
+ Query OK, 0 rows affected (0.11 sec)
368
+
369
+
370
+
371
+ MariaDB [test]> create table plan(
372
+
373
+ -> id int unsigned not null auto_increment,
374
+
375
+ -> name varchar(50),
376
+
377
+ -> main_time int unsigned,
378
+
379
+ -> primary key (id)
380
+
381
+ -> ) engine=InnoDB;
382
+
383
+ Query OK, 0 rows affected (0.01 sec)
384
+
385
+
386
+
387
+ MariaDB [test]> create table play_task(
388
+
389
+ -> id int unsigned not null auto_increment,
390
+
391
+ -> play_day date,
392
+
393
+ -> user_id int unsigned ,
394
+
395
+ -> plan_id int unsigned ,
396
+
397
+ -> primary key (id),
398
+
399
+ -> foreign key(user_id) references user(id)
400
+
401
+ -> on update cascade on delete cascade ,
402
+
403
+ -> foreign key(plan_id) references plan(id)
404
+
405
+ -> on update cascade on delete cascade
406
+
407
+ -> ) engine=InnoDB;
408
+
409
+ Query OK, 0 rows affected (0.01 sec)
410
+
411
+
412
+
413
+ MariaDB [test]> create table amount_day(
414
+
415
+ -> id int unsigned not null auto_increment,
416
+
417
+ -> amount_day date,
418
+
419
+ -> APLAN int unsigned ,
420
+
421
+ -> APLANcount int unsigned ,
422
+
423
+ -> BPLAN int unsigned ,
424
+
425
+ -> BPLANcount int unsigned ,
426
+
427
+ -> CPLAN int unsigned ,
428
+
429
+ -> CPLANcmount int unsigned ,
430
+
431
+ -> primary key (id)
432
+
433
+ ->
434
+
435
+ -> ) engine=InnoDB;
436
+
437
+ Query OK, 0 rows affected (0.01 sec)
438
+
439
+ ```