Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 |
Tags
- Python
- string
- 최솟값
- function
- Machine Learning
- wcss
- data
- matplotlib
- IN
- 반복문
- sklearn
- len()
- pandas
- numpy
- 분류 결과표
- nan
- append()
- hierarchical_clustering
- analizer
- Dictionary
- DataFrame
- count()
- elbow method
- 덴드로그램
- del
- dendrogram
- 최댓값
- DataAccess
- insert()
- list
Archives
- Today
- Total
개발공부
[MySQL] Error Code: 1062. Duplicate entry 가 나오는 이유 본문
insert 할 경우에 Error Code: 1062. Duplicate entry는
insert 할 테이블의 특정 컬럼의 데이터가 unique 해야하는데 이를 어겨서 발생한다.
예를들어 아래와같이 user_id와 movie_id가 unique한 특성을 가진 review 테이블이 있을 때


만약 새로운 데이터를 insert 할 때 user_id 와 movie_id의 값을 똑같이 하여 저장하려 한다면

insert into review (user_id, movie_id, content) values (1, 1, '재미없어요') Error Code: 1062. Duplicate entry '1-1' for key 'review.user_id_movie_id' 0.000 sec
위와 같은 에러가 발생한다.
'Database > MySQL' 카테고리의 다른 글
| [MySQL] SQL의 like와 문자열 컬럼에 fulltext 설정하기 (0) | 2022.05.18 |
|---|---|
| [MySQL] 테이블의 unique 설정하는 방법 (0) | 2022.05.18 |
| [MySQL] NULL인지 아닌지 구별하는 IS NULL, IS NOT NULL (0) | 2022.05.17 |
| [MySQL] group by 의 having 사용법 (0) | 2022.05.17 |
| [MySQL] JOIN 과 LEFT JOIN 하는 방법과 예시 (0) | 2022.05.17 |