Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote