What should i do here: Convert your E-R diagram (I have E-R diagram) to logical
ID: 3916682 • Letter: W
Question
What should i do here:
Convert your E-R diagram (I have E-R diagram) to logical database model . You are to design the table structure, including all needed attributes for each table. You must submit the relational database schema, which consists of the description of all tables, constraints in your database. For each table, please specify the primary key and foreign keys.
Is this answer below cover 'logical database model' and 'relational database schema' or I should add something else. Thanks a lot for your help.
CREATE TABLE ALBUM
(ALBUM_ID VARCHAR (5),
ALBUM_TITLE VARCHAR (50), NOT NULL
Number_of_tracks numeric (3,0),
ALBUM_YEAR NUMERIC (4,0),
ARTIST_ID VARCHAR (8),
RECORD_ID VARCHAR (8),
PRIMARY KEY (ALBUM_ID),
FOREIGN KEY (ARTIST_ID) REFERENCES ARTIST,
FOREIGN KEY (RECORD_ID) REFERENCES RECORD LABEL ;
CREATE TABLE SONG
(SONG_ID VARCHAR (8),
SONG_NAME VARCHAR (50), NOT NULL
SONG_LENGTH NUMERIC (5,2),
ALBUM_ID VARCHAR (8),
ARTISIT_ID VARCHAR (8),
PRIMARY KEY (ALBUM_ID)
FOREIGN KEY (ARTIST_ID) REFERENCES ARTIST );
CREATE TABLE RECORD LABEL
(RECORD_ID VARCHAR (8) ,
RECORD_NAME VARCHAR (50), NOT NULL,
CITY VARCHAR (100),
STATE VARCHAR (10),
COUNTRY VARCHAR (10),
WEBSITE VARCHAR (25),
PRIMARY KEY (RECORD_ID);
CREATE TABLE ARTIST
(ARTIST_ID VARCHAR (8) NOT NULL,
ARTIST_BAND VARCHAR (50)
ARTIST_FNAME VARCHAR (50),
ARTIST_LNAME VARCHAR (50),
PRIMARY KEY (ARTIST _ID);
Explanation / Answer
relational database schema sound perfect for this table as in this database there is relation between tables via primary-foreign key.
Apart for this i want to point out there are issues in code like you haven't mention column name in foreign key references and at few place the coma's are incorrect and instead of numeric you should use decimal, wait.
i have corrected your code, now it is running. There were lots of error, please check your mistakes and make sure you don't repeat it.
?CREATE TABLE ALBUM
(ALBUM_ID VARCHAR (5),
ALBUM_TITLE VARCHAR (50) NOT NULL,
Number_of_tracks numeric (3,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) );
CREATE TABLE SONG
(SONG_ID VARCHAR (8),
SONG_NAME VARCHAR (50) NOT NULL,
SONG_LENGTH DECIMAL(5,2),
ALBUM_ID VARCHAR (8),
ARTIST_ID VARCHAR (8),
PRIMARY KEY (ALBUM_ID),
FOREIGN KEY (ARTIST_ID) REFERENCES ARTIST(ARTIST_ID) );
CREATE TABLE RECORD_LABEL
(RECORD_ID VARCHAR (8) ,
RECORD_NAME VARCHAR (50) NOT NULL,
CITY VARCHAR (100),
STATE VARCHAR (10),
COUNTRY VARCHAR (10),
WEBSITE VARCHAR (25),
PRIMARY KEY (RECORD_ID));
CREATE TABLE ARTIST
(ARTIST_ID VARCHAR (8) NOT NULL,
ARTIST_BAND VARCHAR (50),
ARTIST_FNAME VARCHAR (50),
ARTIST_LNAME VARCHAR (50),
PRIMARY KEY (ARTIST_ID));
Thanks and cheers,
please give a thumbs up if you like,
if not please comment, i will try my best to help.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.