Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

SQL and Relational Algebra Related question There is a Company Database that manages the data of employee, department and project. The relational schemas are as

SQL and Relational Algebra Related question

There is a Company Database that manages the data of employee, department and project. The relational schemas are as follows:

EMPLOYEE (Gname, Fname, Employee_id, Bdate, Gender, Salary, Dno). The attribute means: given name, family name, employee id, birthdate, gender, salary, the department number in which the employee works. Each employee has a unique employee id, and can join in projects that in different department.

DEPARTMENT (Dno, Dname, Manager_id, Dloc). The attribute means: Department number, department name, department manager id, department location. The department manager is a type of the employee, thus the Manager_id is a foreign key that references the Employee_id in EMPLOYEE table.

PROJECT (Project_id, Pname, DNO). The attribute means: project id, project name, department number of the department that the project belongs to.

Part of the data in the relations are as follows

Table1 EMPLOYEE

Gname

Fname

Employee_id

Bdate

Gender

Salary

DNO

Franklin

Wang

20181101

1981-01-16

M

50000

1

Stefan

Li

20182102

1980-05-15

M

60000

2

Jennifer

Wallace

20133101

1978-08-16

F

45000

3

Joyce

Clinton

20183102

1975-06-23

F

28000

3

Peter

Bush

20194101

1990-11-25

M

35000

4

Lucy

Hilton

20181302

1985-10-13

F

65000

1

Table 2 DEPARTMENT

DNO

Dname

Manager_id

Dloc

1

Research

20181105

Shanghai

2

Technology

20182102

Beijing

3

Service

20183101

Shanghai

4

Administration

20184101

Shenzhen

5

Marketing

20135203

Beijing

Table 3 PROJECT

Project_id

Pname

DNO

1001

TransportationMap

1

1002

TwitterFriendship

1

1003

PowerSystem

1

2001

Python

2

2002

Parallel

2

3001

Customer

3

4003

Communication

4

Based on the above relational schema, please write the SQL scripts to do questions 1-6.

Notes: Below this short question-answer you need to give the query results and script take a screenshot and paste it here.

  1. Find the information of employees whose salary is equal to or greater than 50000.
  2. Find the department name and its location which locates in Shenzhen.
  3. Find the number of employees in each department. The result should demonstrate the DNO and the number of employees.
  4. Find the project with its name starting with the character C.
  5. Create a procedure with input parameter. When execute the procedure, it displays the information of a department specified by the user.
  6. Create a trigger, when delete a project from the PROJECT table, delete is not allowed and print the information Deletion of the Project is not allowed.

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_2

Step: 3

blur-text-image_3

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

Databases DeMYSTiFieD

Authors: Andy Oppel

2nd Edition

0071747990, 978-0071747998

More Books

Students also viewed these Databases questions

Question

How would you handle the difficulty level of the texts?

Answered: 1 week ago

Question

The least significant bit is * A D Other:

Answered: 1 week ago