質問編集履歴

1

情報の追加

2020/03/02 03:01

投稿

encho
encho

スコア182

test CHANGED
File without changes
test CHANGED
@@ -405,3 +405,85 @@
405
405
  </html>
406
406
 
407
407
  ```
408
+
409
+ ```sql
410
+
411
+
412
+
413
+ --地域テーブル--
414
+
415
+ CREATE TABLE IF NOT EXISTS region(
416
+
417
+ region_id INTEGER AUTO_INCREMENT NOT NULL,
418
+
419
+ region_name VARCHAR(255) NOT NULL,
420
+
421
+ PRIMARY KEY(region_id)
422
+
423
+ ) ENGINE=INNODB DEFAULT CHARSET=utf8;
424
+
425
+
426
+
427
+
428
+
429
+ --ユーザーテーブル--
430
+
431
+ CREATE TABLE IF NOT EXISTS user(
432
+
433
+ user_id INTEGER AUTO_INCREMENT,
434
+
435
+ mail_address VARCHAR(255) NOT NULL UNIQUE,
436
+
437
+ password VARCHAR(65) NOT NULL,
438
+
439
+ user_name VARCHAR(12) NOT NULL,
440
+
441
+ profile_image VARCHAR(255),
442
+
443
+ gender VARCHAR(10),
444
+
445
+ age INTEGER,
446
+
447
+ region_id INTEGER,
448
+
449
+ self_introduction VARCHAR(300),
450
+
451
+ PRIMARY KEY(user_id),
452
+
453
+ FOREIGN KEY (region_id)
454
+
455
+ REFERENCES region(region_id)
456
+
457
+ ON DELETE CASCADE
458
+
459
+ ) ENGINE=INNODB DEFAULT CHARSET=utf8;
460
+
461
+
462
+
463
+
464
+
465
+ --生徒テーブル--
466
+
467
+ CREATE TABLE IF NOT EXISTS student(
468
+
469
+ student_user_id INTEGER NOT NULL,
470
+
471
+ age_class VARCHAR(20) NOT NULL,
472
+
473
+ request VARCHAR(300),
474
+
475
+ PRIMARY KEY(student_user_id),
476
+
477
+ FOREIGN KEY (student_user_id)
478
+
479
+ REFERENCES user(user_id)
480
+
481
+ ON DELETE CASCADE
482
+
483
+ ) ENGINE=INNODB DEFAULT CHARSET=utf8;
484
+
485
+
486
+
487
+
488
+
489
+ ```