-
Notifications
You must be signed in to change notification settings - Fork 0
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
12/09 : SQLException #6
Comments
`SET FOREIGN_KEY_CHECKS = 0; -- 외래 키 체크 해제 DROP TABLE IF EXISTS cocktail; -- 기존 칵테일 테이블 제거 CREATE DATABASE IF NOT EXISTS cocktail; -- 데이터베이스 생성 USE cocktail; -- 데이터베이스 사용 -- 완전한 user 테이블 생성
|
-- 외래 키 제약 조건 해제 -- 기존 테이블 삭제 -- user 테이블 삭제: user 테이블이 다른 DB에 존재할 가능성 고려 -- 데이터베이스 생성 (필요 시만 생성) -- cocktail 데이터베이스 사용 -- user 테이블 생성 (user 테이블이 이미 존재할 가능성 차단) -- cocktail 테이블 생성 -- cocktail 데이터 삽입 -- ingredient 테이블 생성 -- ingredient 데이터 삽입 -- 외래 키 제약 조건 복원 -- 데이터 확인 해당 sql문 실행 시 ingredient 데이터 생성 완료 / cocktail 데이터 생성 오류 발생 |
-- 외래 키 제약 조건 해제 DROP TABLE IF EXISTS cocktail; -- 데이터베이스 생성 (필요 시만 생성) USE cocktail; -- cocktail 테이블 생성 INSERT INTO cocktail (name, abv, taste, age_group, snacks, price_range, cocktail_info, image, volume) -- 외래 키 제약 조건 복원 -- 데이터 확인 쿼리 해당 쿼리를 다시 실행해줌으로써 cocktail 테이블 관련 오류 해결 |
SET FOREIGN_KEY_CHECKS = 0; -- Disable foreign key checks -- Drop existing tables if they exist -- Create the database and use it -- Create the user table -- Create the cocktail table with cocktail_idx and foreign key constraint -- Insert sample cocktail data -- Restore foreign key checks SELECT * FROM cocktail; |
Caused by: java.sql.SQLException: (conn=1318) Can't create table
cocktail
.calculate_recommended_cocktails
(errno: 150 "Foreign key constraint is incorrectly formed")The text was updated successfully, but these errors were encountered: