Question

This assignment your tasks is to convert the E-R diagram to a relational model and then to SQL. The mapping process is straig

0 0
Add a comment Improve this question Transcribed image text
Answer #1

drop table Artists cascade constraints;
drop table customers cascade constraints;
drop table ARTWORKS cascade constraints;
drop table EXHIBITION cascade constraints;
drop table PAINTING cascade constraints;
drop table SCULPTURE cascade constraints;
drop table STATUE cascade constraints;

CREATE TABLE ARTISTS(ART_ID CHAR(3) PRIMARY KEY,
                   FNAME VARCHAR(15) NOT NULL,
                   MNAME VARCHAR(10),
                   LNAME VARCHAR(15) NOT NULL,
                   BIRTHPLACE VARCHAR(15),
                   DATEBORN DATE,
                   DATEDIED DATE,
                   OCOUNTRY VARCHAR(15),
                   ARTSTYLE VARCHAR(15) NOT NULL);
                  
CREATE TABLE CUSTOMERS(CUST_ID CHAR(3) PRIMARY KEY,
                   FNAME VARCHAR(15) NOT NULL,
                   MNAME VARCHAR(10),
                   LNAME VARCHAR(15) NOT NULL,
                   ADDRESS VARCHAR(15) NOT NULL,
                   TTAMOUNT INT NOT NULL,
                   ART_ID CHAR(3),
                   FOREIGN KEY(ART_ID) REFERENCES ARTISTS(ART_ID));
                  
CREATE TABLE ARTWORKS(ART_WO_ID CHAR(4) PRIMARY KEY,
                   TITLE VARCHAR(15)NOT NULL,
                   YEAR INT NOT NULL,
                   WIDE INT NOT NULL,
                   HEIGHT INT NOT NULL,
                   DESCRIPTION VARCHAR(15),
                   PRICE INT NOT NULL,
                   ART_ID CHAR(3),
                   FOREIGN KEY(ART_ID) REFERENCES ARTISTS(ART_ID));
                     
CREATE TABLE EXHIBITION(NAME VARCHAR(15) PRIMARY KEY,
                       THEME VARCHAR(15) NOT NULL,
                       STARTDATE DATE NOT NULL,
                       ENDDATE DATE NOT NULL,
                       ART_WO_ID CHAR(4),
                       FOREIGN KEY(ART_WO_ID) REFERENCES ARTWORKS(ART_WO_ID));
                      
CREATE TABLE PAINTING(TYPE VARCHAR(15) NOT NULL,
                   MATERIAL VARCHAR(15),
                   ART_WO_ID CHAR(4) ,
                   FOREIGN KEY(ART_WO_ID) REFERENCES ARTWORKS(ART_WO_ID));
                  
CREATE TABLE SCULPTURE(WEIGHT INT,
                   MATERIAL VARCHAR(15),
                   ART_WO_ID CHAR(4) ,
                   FOREIGN KEY(ART_WO_ID) REFERENCES ARTWORKS(ART_WO_ID));
                  
CREATE TABLE STATUE(WEIGHT INT,
                   MATERIAL VARCHAR(15),
                   ART_WO_ID CHAR(4) ,
                   FOREIGN KEY(ART_WO_ID) REFERENCES ARTWORKS(ART_WO_ID));
                  
                      
DESC ARTISTS;
DESC CUSTOMERS;
DESC ARTWORKS;
DESC EXHIBITION;
DESC PAINTING;
DESC SCULPTURE;
DESC STATUE;

ARTISTS Artists may or may not be contain middle name and hence middle name can contain null value.
Similarly DOB,datedied and birthpalce may or nay not be exists for a specified artists and hence these three
fields may contain null values.

CUSTOMERS customer may or may not be contain middle name and hence middle name can contain null value.

ARTWORK some authors want to describe the ART and some do not want to describe hence decription field ma contain null values.

PAINTING - Material used for painting may contain null values.

SCULPTURE,STATUE if Artists want to mention weight and material of SCULPTURE,STATUE then they mention other it contains null values.

SQL> SQL> DESC ARTISTS Name Nu11? Type NOT NULL CHAR(3) ART_ID FNAME NOT NULL UARCHAR2(15) UARCHAR2(10) NOT NULL UARCHAR2(15)

SQL> DESC PAINTING; Мane Nul1? Type ТУРЕ NOT NULL UARCHAR2(15) UARCHAR2(15) CHAR(4) МАTERIAL ART_WO_ID SQL> DESC SCULPTURE; N

ARUNS- ADENO N 3978 CATE ARTISTS ARI-ID ENAME MNAME LNAME BIRTHPLACE DATEBORN DATEDIEO OC OUNTRY ARTSTYLE FUSTOMERS CuS7-1D

Add a comment
Know the answer?
Add Answer to:
This assignment your tasks is to convert the E-R diagram to a relational model and then...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT