Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[20230101] MySQL Recursive Insert(Dummy Data) #270

Open
JuHyun419 opened this issue Jan 1, 2023 · 0 comments
Open

[20230101] MySQL Recursive Insert(Dummy Data) #270

JuHyun419 opened this issue Jan 1, 2023 · 0 comments
Labels

Comments

@JuHyun419
Copy link
Owner

MySQL에서 재귀를 이용해 더미 데이터 삽입하기)

  • PK를 제외한 데이터는 모두 동일하게 복사하는데, 데이터도 랜덤으로 다른 값 생성해서 넣는 것도 가능할듯
CREATE TABLE `salaries` (
  `sal_id` int NOT NULL AUTO_INCREMENT,
  `emp_no` varchar(45) DEFAULT NULL,
  `amount` varchar(45) NOT NULL,
  PRIMARY KEY (`sal_id`,`amount`)
) ENGINE=InnoDB AUTO_INCREMENT=5635994 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;


INSERT INTO salaries(emp_no, amount)
(SELECT emp_no, amount FROM salaries);

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant