Question

Task 2 [40 points Given an ER diagram (as shown below), write SQL statements to create the corresponding relations and captur


CAN YOU PLEASE EXPLAIN IN TASK 3 - HOW DO WE REPRESENT TOTAL PARTICIPATION AND KEY CONSTRAINTS IN SQL CODE. PLEASE PROVIDE SOLUTION AND DETAILED EXPLANATION.

I WOULD REALLY APPRECIATE IF YOU CAN HELP ME WITH THE ABOVE 2 QUESTIONS.

I WILL DEFINITELY RATE!!

Thank you.

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

(A.) FIrst we will Create the table from the given ER diagram , Each entities will have there own different tables every attributes become the column of the table, with this concept there will be three tables:

(1) First table will be the PROFESSOR table in which Professor is the strong entity and hence each tuples of the Professor table can be uniquely identified by primary key which is P id (as this attribute is represented by underline in the ER diagram).Also there are two relation between table professor and department table, one is professor works in department and other is department manages by professor, for first relation (works in) we need foreign key to uniquely identify the Department in Professor table on join. therefore there is the need of KEY CONSTRAINTS in the Professor table ,also P id is the primary key of the table therefore value of P id cannot be null hence we will add NOT NULL constraints in the table construction.SQL query will be :-

CREATE TABLE Professor (
P id int (10)NOT NULL,
title varchar(5),
    Phone int(10), Salary int(10), Building varchar(50),
    PRIMARY KEY (P id),
    FOREIGN KEY (D id) REFERENCES Department(D id)
);

(2) Second table will be the DEPARTMENT table in which Department is the strong entity and hence each tuples of the department table can be uniquely identifies by primary key which is D id (as this attribute is represented by underline in the ER diagram).Also there are two relation between table department and professor table, one is professor works in department and other is department manages by professor, for second relation (manages) we need foreign key to uniquely identify the professor in department table on join. therefore there is the need of KEY CONSTRAINTS in the Department table ,also D id is the primary key of the table therefore value of D id cannot be null hence we will add NOT NULL constraints in the table construction.

SQL query will be :-

CREATE TABLE Department (
D id int (10)NOT NULL,
D name varchar(25),
budget int(10),
    PRIMARY KEY (D id),
    FOREIGN KEY (P id) REFERENCES Professor(P id)
);

(3) Third table will be the CHILD table in which Child is the weak entity as there is no primary key which is able to uniquely distinguish each tuples ,name can be a key but it is not able to distinguish all the tuples, therefore we need any foreign key to uniquely identify the tuples of the child table .Also there is a relation between table department and child table, which is child has professor as dependent ,there is the need of REFERENTIAL INTEGRITY  CONSTRAINTS in the Child table during the table construction.

SQL query will be :-

CREATE TABLE Child (
Name varchar(25),
Age int(2),
    FOREIGN KEY (P id) REFERENCES Professor(P id)
);

(B.) Now if we talk about the second part of the question clearly here also we have to make three tables A,B,C which shares the ternary relationship which means each table is connected to other table with one same relationshipwhich are following:-

(1.) The table A contains a1 and a2 as attributes which are of string types of length 10 and attribute a1 is the primary key and table A has the key constraints, with these points we can create table by using SQL query as follows:-

CREATE TABLE A (
a1 varchar(10)NOT NULL,
a2 varchar(10),
    PRIMARY KEY (a1),
    FOREIGN KEY (b1) REFERENCES B(b1),   FOREIGN KEY (c1) REFERENCES C(c1)
);

(2.) The table B contains b1 and b2 as attributes which are of string types of length 10 and attribute b1 is the primary key and table B has the key constraints, with these points we can create table by using SQL query as follows:-

CREATE TABLE B (
b1 varchar(10)NOT NULL,
b2 varchar(10),   
    PRIMARY KEY (b1),
    FOREIGN KEY (a1) REFERENCES A(a1),   FOREIGN KEY (c1) REFERENCES C(c1)
);

(3.) The table C contains c1 and c2 as attributes which are of string types of length 10 and attribute c1 is the primary key and table C has the key constraints and total participation which can be represented by using foreign key in query, with these points we can create table by using SQL query as follows:-

CREATE TABLE C (
c1 varchar(10)NOT NULL,
c2 varchar(10),
    PRIMARY KEY (c1),
    FOREIGN KEY (a1) REFERENCES A(a1),   FOREIGN KEY (b1) REFERENCES B(b1)
);

Add a comment
Know the answer?
Add Answer to:
CAN YOU PLEASE EXPLAIN IN TASK 3 - HOW DO WE REPRESENT TOTAL PARTICIPATION AND KEY...
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
  • Considering the following E-R diagram, your task is to create a script file for defining relations and populating data,...

    Considering the following E-R diagram, your task is to create a script file for defining relations and populating data, you can use any text editor (notepad/notepad+) to write SQL statements and save it with the file extension.sql (i.e., Test3Tsay.sql). Name the file as Test3XXX.sql (where XXX is your last name). Upload it to here. endedDate phone startedDate name address name location no salary no Employees Projects assignDate P WorksOn Scientists Technicians research hEduDegree N certifications Equipments cost no Task 1...

  • This assignment your tasks is to convert the E-R diagram to a relational model and then...

    This assignment your tasks is to convert the E-R diagram to a relational model and then to SQL. The mapping process is straightforward. Three components of the conversion process are Specify schema of relation itself Specify primary key on the relation Specify any foreign key references to other relations 1. 2. 3. dateBorn mName birthPlace IName dateDied fName IName address - oCountry ID mName ttlAmt Customers N Artists M Favors fName artStyle ID N Creates Like M startedDate theme title...

  • Answer the following and explain so I can double check my answers If you use the Management Studio to create a database, the Studio will automatically create a database file plus a ________________...

    Answer the following and explain so I can double check my answers If you use the Management Studio to create a database, the Studio will automatically create a database file plus a ______________________ file. 10 points    QUESTION 2 When you use the Management Studio to create a check constraint, you can specify whether you want the constraint enforced for insert or __________________ operations. 10 points    QUESTION 3 When you use the Management Studio to create a database, including its tables...

  • database and sql problme THE QUESTIONS 3, 4,5 and 6 REFER TO THE RELATIONAL TABLES LISTED...

    database and sql problme THE QUESTIONS 3, 4,5 and 6 REFER TO THE RELATIONAL TABLES LISTED BELOW CREATE TABLE Department ( DECIMAL(5) VARCHAR(30) CHAR(5) DATE NOT NULL NOT NULL NOT NULL * Department number /*Department name * Department manager number */ /Manager start date DNumber DName Manager MSDate CONSTRAINT Department_PK PRIMARY KEY(DNumber) CONSTRAINT Department_CK UNIQUE(DName) CREATE TABLE DeptLocation DECIMAL(5) VARCHAR(50) NOT NULL NOT NULL DNumber * Department number */ * Department location */ Address CONSTRAINT DeptLocation_PK PRIMARY KEY(DNumber, Address) CONSTRAINT...

  • The lab for this week addresses taking a logical database design (data model) and transforming it...

    The lab for this week addresses taking a logical database design (data model) and transforming it into a physical model (tables, constraints, and relationships). As part of the lab, you will need to download the zip file titled CIS336Lab3Files from Doc Sharing. This zip file contains the ERD, Data Dictionary, and test data for the tables you create as you complete this exercise. Your job will be to use the ERD Diagram found below as a guide to define the...

  • For this set of Review Questions, we will create and use a database for the Wedgewood...

    For this set of Review Questions, we will create and use a database for the Wedgewood Pacific Corporation (WPC) that is similar to the Microsoft Access database we created and used in Chapters 1 and 2. Founded in 1957 in Seattle, Washington, WPC has grown into an internationally recognized organization. The company is located in two buildings. One building houses the Administration, Accounting, Finance, and Human Resources departments, and the second houses the Production, Marketing, and Information Systems departments. The...

  • (MMU) has decided to consolidate the functionality of three small overlapping database systems, which support applications...

    (MMU) has decided to consolidate the functionality of three small overlapping database systems, which support applications for 1) teaching (e.g. instructor assignment and evaluation), for 2) registration (e.g. online course status, waiting lists), and for 3) student records (e.g. transcript generation) The resulting new system will support the following enterprise description: Professors and GTAs are assigned to teach the sections of each class being offered in a semester. At the end of the semester, they get a "team rating" (professors...

  • Please finish all 6 parts with indexing SQL. Don't need to do the measure time things, but you can do it if you wanna do it. Thanks! Write the following SQL queries and measure their execution t...

    Please finish all 6 parts with indexing SQL. Don't need to do the measure time things, but you can do it if you wanna do it. Thanks! Write the following SQL queries and measure their execution time both with and without using indexes 1. Count how many parts in NYC have more than 70 parts on hand 2. Count how many total parts on hand, in both NYC and SFO, are Red 3. List all the suppliers that have more...

  • can I get some help please? Problem 2. "Do you think we are prepared for another...

    can I get some help please? Problem 2. "Do you think we are prepared for another terrorist attack?" Public opinion pollsters report the results of such poll questions as the proportion who respond affirmatively (ie, they say YES) and a "margin of error." By "margin of error," they mean the quantity that is added to, and subtracted from, the point estimate to get the upper and lower confidence limits. Suppose that you work for such a pollster, and that you...

  • Due to your experience in designing the database for the "Legendary League" game, you have been...

    Due to your experience in designing the database for the "Legendary League" game, you have been asked to design the ER diagram for a bigger database to manage the events for the "Legendary League" eSports Oceanic Championship (OC). The requirements are as follows: Registered teams compete in the OC. Each team has a name, and a number of team members. A team also maintains a rank throughout the OC, reflecting how well it is doing in the championship. Team members...

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