김태희

db sql문 변경

1 +-- MySQL dump 10.13 Distrib 8.0.16, for Win64 (x86_64)
2 +--
3 +-- Host: 127.0.0.1 Database: os_prj01
4 +-- ------------------------------------------------------
5 +-- Server version 8.0.16
6 +
7 +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8 +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9 +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10 + SET NAMES utf8 ;
11 +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12 +/*!40103 SET TIME_ZONE='+00:00' */;
13 +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14 +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15 +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16 +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17 +
18 +--
19 +-- Table structure for table `caltable`
20 +--
21 +
22 +DROP TABLE IF EXISTS `caltable`;
23 +/*!40101 SET @saved_cs_client = @@character_set_client */;
24 + SET character_set_client = utf8mb4 ;
25 +CREATE TABLE `caltable` (
26 + `idCalTable` int(11) NOT NULL AUTO_INCREMENT,
27 + `CalTotal` int(11) NOT NULL,
28 + `CalLeftover` int(11) NOT NULL,
29 + PRIMARY KEY (`idCalTable`)
30 +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
31 +/*!40101 SET character_set_client = @saved_cs_client */;
32 +
33 +--
34 +-- Dumping data for table `caltable`
35 +--
36 +
37 +LOCK TABLES `caltable` WRITE;
38 +/*!40000 ALTER TABLE `caltable` DISABLE KEYS */;
39 +INSERT INTO `caltable` VALUES (1,300,20);
40 +/*!40000 ALTER TABLE `caltable` ENABLE KEYS */;
41 +UNLOCK TABLES;
42 +
43 +--
44 +-- Table structure for table `consume`
45 +--
46 +
47 +DROP TABLE IF EXISTS `consume`;
48 +/*!40101 SET @saved_cs_client = @@character_set_client */;
49 + SET character_set_client = utf8mb4 ;
50 +CREATE TABLE `consume` (
51 + `ConsumeNo` int(11) NOT NULL AUTO_INCREMENT,
52 + `ConsumeDate` datetime NOT NULL,
53 + `ConsumeDetail` varchar(45) NOT NULL,
54 + PRIMARY KEY (`ConsumeNo`)
55 +) ENGINE=InnoDB DEFAULT CHARSET=utf8;
56 +/*!40101 SET character_set_client = @saved_cs_client */;
57 +
58 +--
59 +-- Dumping data for table `consume`
60 +--
61 +
62 +LOCK TABLES `consume` WRITE;
63 +/*!40000 ALTER TABLE `consume` DISABLE KEYS */;
64 +/*!40000 ALTER TABLE `consume` ENABLE KEYS */;
65 +UNLOCK TABLES;
66 +
67 +--
68 +-- Table structure for table `user`
69 +--
70 +
71 +DROP TABLE IF EXISTS `user`;
72 +/*!40101 SET @saved_cs_client = @@character_set_client */;
73 + SET character_set_client = utf8mb4 ;
74 +CREATE TABLE `user` (
75 + `UserID` varchar(20) NOT NULL,
76 + `UserPw` varchar(45) NOT NULL,
77 + `UserNo` int(11) NOT NULL,
78 + PRIMARY KEY (`UserNo`)
79 +) ENGINE=InnoDB DEFAULT CHARSET=utf8;
80 +/*!40101 SET character_set_client = @saved_cs_client */;
81 +
82 +--
83 +-- Dumping data for table `user`
84 +--
85 +
86 +LOCK TABLES `user` WRITE;
87 +/*!40000 ALTER TABLE `user` DISABLE KEYS */;
88 +/*!40000 ALTER TABLE `user` ENABLE KEYS */;
89 +UNLOCK TABLES;
90 +
91 +--
92 +-- Table structure for table `userinfo`
93 +--
94 +
95 +DROP TABLE IF EXISTS `userinfo`;
96 +/*!40101 SET @saved_cs_client = @@character_set_client */;
97 + SET character_set_client = utf8mb4 ;
98 +CREATE TABLE `userinfo` (
99 + `UserNo` int(11) NOT NULL,
100 + `UserHeight` int(11) NOT NULL,
101 + `UserWeight` int(11) NOT NULL,
102 + `UserAge` int(11) NOT NULL,
103 + `UserGender` tinyint(4) NOT NULL,
104 + PRIMARY KEY (`UserNo`)
105 +) ENGINE=InnoDB DEFAULT CHARSET=utf8;
106 +/*!40101 SET character_set_client = @saved_cs_client */;
107 +
108 +--
109 +-- Dumping data for table `userinfo`
110 +--
111 +
112 +LOCK TABLES `userinfo` WRITE;
113 +/*!40000 ALTER TABLE `userinfo` DISABLE KEYS */;
114 +/*!40000 ALTER TABLE `userinfo` ENABLE KEYS */;
115 +UNLOCK TABLES;
116 +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
117 +
118 +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
119 +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
120 +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
121 +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
122 +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
123 +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
124 +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
125 +
126 +-- Dump completed on 2019-06-05 21:57:07
1 --- MySQL Workbench Forward Engineering
2 -
3 -SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
4 -SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
5 -SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
6 -
7 --- -----------------------------------------------------
8 --- Schema mydb
9 --- -----------------------------------------------------
10 -
11 --- -----------------------------------------------------
12 --- Schema mydb
13 --- -----------------------------------------------------
14 -CREATE SCHEMA IF NOT EXISTS `mydb` DEFAULT CHARACTER SET utf8 ;
15 --- -----------------------------------------------------
16 --- Schema os_prj01
17 --- -----------------------------------------------------
18 -
19 --- -----------------------------------------------------
20 --- Schema os_prj01
21 --- -----------------------------------------------------
22 -CREATE SCHEMA IF NOT EXISTS `os_prj01` DEFAULT CHARACTER SET utf8 ;
23 -USE `mydb` ;
24 -
25 --- -----------------------------------------------------
26 --- Table `mydb`.`calinfo`
27 --- -----------------------------------------------------
28 -CREATE TABLE IF NOT EXISTS `mydb`.`calinfo` (
29 - `CalTotal` VARCHAR(45) NOT NULL,
30 - `UserNo` INT(11) NOT NULL,
31 - `ConsumeDate` DATETIME NOT NULL,
32 - `CalNo` INT(11) NOT NULL AUTO_INCREMENT,
33 - PRIMARY KEY (`CalNo`))
34 -ENGINE = InnoDB
35 -DEFAULT CHARACTER SET = utf8;
36 -
37 -
38 --- -----------------------------------------------------
39 --- Table `mydb`.`consumeinfo`
40 --- -----------------------------------------------------
41 -CREATE TABLE IF NOT EXISTS `mydb`.`consumeinfo` (
42 - `ConsumeNo` INT(11) NOT NULL,
43 - `ConsumeDetail` VARCHAR(45) NOT NULL,
44 - `ConsumeDate` DATETIME NOT NULL,
45 - `UserInfo_UserId` INT(11) NOT NULL,
46 - PRIMARY KEY (`ConsumeNo`),
47 - INDEX `fk_ConsumeInfo_UserInfo_idx` (`UserInfo_UserId` ASC) VISIBLE)
48 -ENGINE = InnoDB
49 -DEFAULT CHARACTER SET = utf8;
50 -
51 -
52 --- -----------------------------------------------------
53 --- Table `mydb`.`userinfo`
54 --- -----------------------------------------------------
55 -CREATE TABLE IF NOT EXISTS `mydb`.`userinfo` (
56 - `UserNo` VARCHAR(45) NOT NULL,
57 - `UserID` VARCHAR(10) NOT NULL,
58 - `UserPW` VARCHAR(45) NOT NULL,
59 - `UserName` VARCHAR(45) NOT NULL,
60 - `UserHeight` INT(11) NOT NULL,
61 - `UserWeight` INT(11) NOT NULL,
62 - `UserGender` TINYINT(4) NOT NULL,
63 - `UserAge` INT(11) NOT NULL,
64 - PRIMARY KEY (`UserNo`))
65 -ENGINE = InnoDB
66 -DEFAULT CHARACTER SET = utf8;
67 -
68 -USE `os_prj01` ;
69 -
70 --- -----------------------------------------------------
71 --- Table `os_prj01`.`user`
72 --- -----------------------------------------------------
73 -CREATE TABLE IF NOT EXISTS `os_prj01`.`user` (
74 - `UserID` VARCHAR(20) NOT NULL,
75 - `UserPw` VARCHAR(45) NOT NULL,
76 - `UserNo` INT(11) NOT NULL AUTO_INCREMENT,
77 - PRIMARY KEY (`UserNo`))
78 -ENGINE = InnoDB
79 -DEFAULT CHARACTER SET = utf8;
80 -
81 -
82 --- -----------------------------------------------------
83 --- Table `os_prj01`.`caltable`
84 --- -----------------------------------------------------
85 -CREATE TABLE IF NOT EXISTS `os_prj01`.`caltable` (
86 - `idCalTable` INT(11) NOT NULL AUTO_INCREMENT,
87 - `CalTotal` INT(11) NOT NULL,
88 - `CalLeftover` INT(11) NOT NULL,
89 - `CalUserNo` VARCHAR(45) NOT NULL,
90 - `user_UserNo` INT(11) NOT NULL,
91 - PRIMARY KEY (`idCalTable`, `user_UserNo`),
92 - INDEX `fk_caltable_user1_idx` (`user_UserNo` ASC) VISIBLE,
93 - CONSTRAINT `fk_caltable_user1`
94 - FOREIGN KEY (`user_UserNo`)
95 - REFERENCES `os_prj01`.`user` (`UserNo`)
96 - ON DELETE NO ACTION
97 - ON UPDATE NO ACTION)
98 -ENGINE = InnoDB
99 -AUTO_INCREMENT = 2
100 -DEFAULT CHARACTER SET = utf8;
101 -
102 -
103 --- -----------------------------------------------------
104 --- Table `os_prj01`.`consume`
105 --- -----------------------------------------------------
106 -CREATE TABLE IF NOT EXISTS `os_prj01`.`consume` (
107 - `ConsumeNo` INT(11) NOT NULL AUTO_INCREMENT,
108 - `ConsumeDate` DATETIME NOT NULL,
109 - `ConsumeDetail` VARCHAR(45) NOT NULL,
110 - `user_UserNo` INT(11) NOT NULL,
111 - PRIMARY KEY (`ConsumeNo`),
112 - INDEX `fk_consume_user1_idx` (`user_UserNo` ASC) VISIBLE,
113 - CONSTRAINT `fk_consume_user1`
114 - FOREIGN KEY (`user_UserNo`)
115 - REFERENCES `os_prj01`.`user` (`UserNo`)
116 - ON DELETE NO ACTION
117 - ON UPDATE NO ACTION)
118 -ENGINE = InnoDB
119 -DEFAULT CHARACTER SET = utf8;
120 -
121 -
122 --- -----------------------------------------------------
123 --- Table `os_prj01`.`userinfo`
124 --- -----------------------------------------------------
125 -CREATE TABLE IF NOT EXISTS `os_prj01`.`userinfo` (
126 - `UserHeight` INT(11) NOT NULL,
127 - `UserWeight` INT(11) NOT NULL,
128 - `UserAge` INT(11) NOT NULL,
129 - `UserGender` TINYINT(4) NOT NULL,
130 - `user_UserNo` INT(11) NOT NULL,
131 - PRIMARY KEY (`user_UserNo`),
132 - INDEX `fk_userinfo_user_idx` (`user_UserNo` ASC) VISIBLE,
133 - CONSTRAINT `fk_userinfo_user`
134 - FOREIGN KEY (`user_UserNo`)
135 - REFERENCES `os_prj01`.`user` (`UserNo`)
136 - ON DELETE NO ACTION
137 - ON UPDATE NO ACTION)
138 -ENGINE = InnoDB
139 -DEFAULT CHARACTER SET = utf8;
140 -
141 -
142 -SET SQL_MODE=@OLD_SQL_MODE;
143 -SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
144 -SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;