I created a database CD ( i don\'t know correctly or not): create database CD th
ID: 3916732 • Letter: I
Question
I created a database CD ( i don't know correctly or not):
create database CD
then I wanted to create a table:
CREATE TABLE ALBUM
(ALBUM_ID VARCHAR (7),
ALBUM_TITLE VARCHAR (50) NOT NULL,
Number_of_tracks numeric (2,0),
ALBUM_YEAR NUMERIC (4,0),
ARTIST_ID VARCHAR (8),
RECORD_ID VARCHAR (8),
PRIMARY KEY (ALBUM_ID),
FOREIGN KEY (ARTIST_ID) REFERENCES ARTIST (ARTIST_ID),
FOREIGN KEY (RECORD_ID) REFERENCES RECORD_LABEL(RECORD_ID));
But I received an ERROR:
Can't create table 'cd_album' (errno 150)
What I did wrong?
Thank you for your help
Explanation / Answer
The error no 150 indicates that, the FOREIGN KEY are not formed well, please check the column names and types and sizes in the both the tables and constraints also like Not null etc. If it NotNull in Artist table than declare similarly here also
Please comment below, if you still face the issue
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.