Advanced DB group Ass
Advanced DB group Ass
GROUP II MEMBERS
NO IDNO NAME
Relationships:
Project-Professor (One-to-Many)
Professor-Department (Many-to-Many)
Each graduate student has a student advisor (more senior graduate student).
Graduate Student
c) To map the ER model into a relational data model, we can create tables based on the entities and
relationships identified:
Advisor_SSN (FK)
Starting_Date Role
Ending_Date
Budget
Principal_Investigator_SSN (FK)
SSN INT PRIMARY KEY, Name VARCHAR(255), Age INT, Ranks VARCHAR(255), Research_Specialty
VARCHAR(255));
SSN INT PRIMARY KEY, Name VARCHAR(255), Age INT, Degree_Program VARCHAR(255),
Major_Dept_Number INT, Advisor_SSN INT);
e) Here are example SQL queries to insert at least two records for each table:
VALUES (101, 'Computer Science', 'Building A', 123456789), (102, 'Mathematics', 'Building B',
987654321);
These SQL queries will create the tables and insert example records into each table based on the given
information.
3. To convert the given table into second normal form (2NF), first we need to convert it to first normal
form (1NF).
To convert the given table into second normal form (2NF), we need to eliminate any partial
dependencies. Partial dependencies occur when non-key attributes depend on only part of the primary
key. In this case, we have a composite primary key consisting of Stud_Name and Course_id.
To achieve 2NF, we can break down the table into two separate tables: one for student information and
another for course information.
The Grades table serves as the junction table, connecting the Students and Courses tables. It includes
foreign key references to both primary keys in the respective tables. This design eliminates partial
dependencies and ensures that each attribute depends on the entire primary key.
Table 3: Grades
Now, the data is organized into separate tables, and each attribute depends on the entire primary key in
the respective table. The tables are in second normal form (2NF).
4. a) The SQL equivalent of the relational algebra expression πStu_ID, FName, LName, Stu_Email (σ gpa >
3.5(STUDENT)) is:
SELECT Stu_ID, FName, LName, Stu_Email FROM STUDENT WHERE gpa > 3.5;
b) The relational algebra equivalent of the SQL expression SELECT DISTINCT Emp_ID, Emp_Name,
Address, Salary FROM EMPLOYEE; is:
c) The SQL equivalent of the relational algebra expression that finds Emp_ID, Emp_Name, Address,
Salary of all employees whose salary is greater than or equal to 30,000 is:
SELECT Emp_ID, Emp_Name, Address, Salary FROM EMPLOYEE WHERE Salary >= 30000;