SQL relational database

10 pts.
Tags:
SQL queries
SQL relational database
A relational database contains the following tables: Employee (EmployeeNo, EmployeeName, DateOfBirth, JobDescription,DeptNo) Project (ProjectNo, ProjectName, Location)Assignment (EmployeeNo, ProjectNo, Role-in-Project)Formulate the following using SQL:i. Find the names of all employees assigned to a project. List the employee names in an alphabetical order.

Answer Wiki

Thanks. We'll let you know when a new response is added.

You could do something like this:

SELECT e.EmployeeName
FROM Employee e
INNER JOIN Assignment a ON e.EmployeeNo=a.EMployeeNo
INNER JOIN Project p ON p.ProjectNo=a.ProjectNo
WHERE p.ProjectName=’_specific_projectname_’
ORDER BY e.EmployeeName

If you’re looking for all employees for all existing projects, then:

SELECT p.ProjectName,e.EmployeeName
FROM Employee e
INNER JOIN Assignment a ON e.EmployeeNo=a.EMployeeNo
INNER JOIN Project p ON p.ProjectNo=a.ProjectNo
WHERE p.ProjectName=’_specific_projectname_’
ORDER BY p.ProjectName,e.EmployeeName,

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Denny Cherry
    You need to join the three tables together, on EmployeeNo and ProjectNo, and use an ORDER BY statement to sort the data. No I won't give you the SQL answer your to your school assignment.
    66,070 pointsBadges:
    report
  • BrentSheets
    Moderator Note: Denny is exactly right. IT Knowledge Exchange isn't a place to have others answer your school assignments. But if you're studying for a career in IT or development and have run into a problem after attempting to solve it yourself - then post your code or a detailed explanation and maybe someone can point out the problem - or at least point you in the right direction (as Denny did above). I see this is your first question, so welcome to IT Knowledge Exchange. Thanks.
    6,925 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following