아빠는 개발자

Database 본문

Investment

Database

father6019 2024. 5. 26. 21:39
728x90
반응형

내 투자회사의 첫 DB 

-- 국내 투자 정보

CREATE TABLE `investment` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `company` varchar(200) NOT NULL,
  `exchange` varchar(200) NOT NULL,
  `type` varchar(20) NOT NULL,
  `price` bigint NOT NULL default 0,
  `quantity` bigint NOT NULL default 0,  
  `use_yn` enum('Y','N') NOT NULL DEFAULT 'Y',
  `created_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `company_index` (`company`,`exchange` )
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;


-- 해외 투자 crawler

CREATE TABLE `stock` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `company` varchar(100) NOT NULL,
  `company_code` varchar(20) NOT NULL,
  `exchange` varchar(30) NOT NULL,
  `start_date` date NOT NULL,
  `end_date` date NOT NULL,    
  `use_yn` enum('Y','N') NOT NULL DEFAULT 'Y',
  `created_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `company_code_index` (`company_code` )
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

 

728x90
반응형

'Investment' 카테고리의 다른 글

[CRAWLER] Data 수집 - yahoo finance  (2) 2024.06.01