Relational Algebra expression am I correct?

Posted on 2011-09-11
Last Modified: 2012-05-12
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, (
Question by:Rowley4
  • 5
  • 3
LVL 59

Expert Comment

by:Kevin Cross
ID: 36519350
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.

Author Comment

ID: 36519364
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.

Author Comment

ID: 36519375
This is separate from my other question.
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

LVL 59

Expert Comment

by:Kevin Cross
ID: 36519407
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.

Author Comment

ID: 36519410
I am using Relational Algebra for this one rather than just SQL.
LVL 59

Accepted Solution

Kevin Cross earned 500 total points
ID: 36519461
See if this helps get you going:
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.

Author Comment

ID: 36519466
Yes!! Perfect.. This was a great.

Author Closing Comment

ID: 36519467
This is exactly what I needed. Thank you so much!

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Proportion 4 49
Relative Frequency Distribution 4 36
My 2003 Land Rover discovery 2 key for code for car alarm 7 125
finding artist from picture(portrait) 5 109
A Guide to the PMT, FV, IPMT and PPMT Functions In MS Excel we have the PMT, FV, IPMT and PPMT functions, which do a fantastic job for interest rate calculations.  But what if you don't have Excel ? This article is for programmers looking to re…
This article seeks to propel the full implementation of geothermal power plants in Mexico as a renewable energy source.
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question