Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help for SQL DDL statements. Please do not use CHATGPT. Thank you in advance Question 1 . Consider the following schema given in

I need help for SQL DDL statements. Please do not use CHATGPT. Thank you in advance
Question 1. Consider the following schema given in Figure 1 where the underlined attributes are primary keys and the arrows between relations depict the foreign key-primary key relationships. Also consider the following information about relations and give the appropriate DDL statements to create each relation.
Note: A straightforward solution would not allow you to insert tuples into EMPLOYEE and/or DEPARTMENT after creation. So, you need to be careful how you create these tables and modify them after an insertion. If you can figure out how to do this, there is a bonus of points.
1. In EMPLOYEE, Fname and Lname can vary in length with a maximum of 15 characters; Minit is a single character; SIN consist of 9 characters; Address is variable length up to 30 characters; Sex is identified as M or F; Salary is a decimal number with 10 digits and 2 digits after the decimal point; Super Id has the same specification as SIN; Dno is an integer; Bdate is of type date. For each tuple, Fname, Lname, SIN, have to be specified, and each employee has to be assigned to a department.
2. In DEPARTMENT, Dname is variable length character string with a maximum length of 15; Mgr SIN is a fixed length string of 9; Dnumber is an integer; and Mgr start date is a date. Dname and Mgr SIN have to be specified, and every department has to have a manager.
3. In DEPT LOC, Dnumber is the same as what it is in DEPARTMENT, and Dlo cation is a variable length character string of at most 15 characters. Both of these have to be specified for any tuple.
4. In PROJECT, Pname and Plocation are maximum 15-character strings; Pnumber and Dnum are integers. Pname, Pnumber and Dnum have to be specified for each tuple.
5. In WORKS ON, E SIN is a 9-character string; Pno is an integer; and Hours is a 3-digit decimal number with one digit after the decimal point. All of these have to be specified for each tuple.
6. In DEPENDENT, E SIN is the same as it is in WORKS ON; Dependent name is a character string of up to 15 characters; Sex is identified as M or F; Bdate is a date; and Relationship is a character string of up to 8 characters.
EMPLOYEE
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Mining Concepts And Techniques

Authors: Jiawei Han, Micheline Kamber, Jian Pei

3rd Edition

0123814790, 9780123814791

More Books

Students also viewed these Databases questions

Question

How can public relations be used successfully in IMC?

Answered: 1 week ago