[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 451
  • Last Modified:

Relational Algebra expression am I correct?

Provide an expression in relational algebra that shows the following query:
Find the names, genders and social security numbers of all employees who have been managers in the last 2 years.

    * employee (emp_id,f_name,l_name,dob,ssn,gender,hire_date)
    * address (emp_id,street,city,state,zip,country,phone)
    * department (dept_id,name)
    * emp_in_dept (emp_id,dept_id,begin_date,end_date)
    * mgr_of_dept (dept_id,emp_id,begin_date,end_date)
    * salary(emp_id,salary,begin_date,end_date)
    * job_title(emp_id,title,begin_date,end_date)

I started with this but I am not sure how to complete the comparing part.

PROJECT f_name, l_name, gender, ssn, (
0
Rowley4
Asked:
Rowley4
  • 5
  • 3
1 Solution
 
Kevin CrossChief Technology OfficerCommented:
Rowley4, is this a school assignment? Not a big deal if it is, we just need to ensure we are "teaching" you correctly if it is. :)

With that in mind, please post what you have tried so far. It appears it got cut off. With your code as a starting point, we can help guide you.
0
 
Rowley4Author Commented:
I have started the code, but I am unsure how to finish it. This is what I have so far.

PROJECT f_name, l_name, gender, ssn, (

I am jut not sure how to write the comparing part when I have no actual dates. I thought it would be > 2009? But not sure how to put that in.
0
 
Rowley4Author Commented:
This is separate from my other question.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
Kevin CrossChief Technology OfficerCommented:
What you have there isn't close to a SQL statement, so not sure what to put next either. so this homework. I will see what I can mock up to help explain things for you like Patrick did in your other question.
0
 
Rowley4Author Commented:
I am using Relational Algebra for this one rather than just SQL.
0
 
Kevin CrossChief Technology OfficerCommented:
See if this helps get you going: http://db.grussell.org/section010.html#_Toc67114473
Something like this:
PROJECT f_name, l_name, gender, ssn (SELECT begin_date >= '20090101' (employee JOIN employee.emp_id = mgr_of_dept.emp_id mgr_of_dept))

Assumptions: employee managed a department; could have a manager in title only, which you could capture by making the relationship to job_title. Hopefully this helps you get going. You can combine the PROJECT and SELECT for what you need.
0
 
Rowley4Author Commented:
Yes!! Perfect.. This was a great.
0
 
Rowley4Author Commented:
This is exactly what I needed. Thank you so much!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now