dbTalk Databases Forums  

Relational Algebra Expression

comp.databases.theory comp.databases.theory


Discuss Relational Algebra Expression in the comp.databases.theory forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
gamehack
 
Posts: n/a

Default Relational Algebra Expression - 02-09-2008 , 10:32 AM






Hi,

I've been trying to figure out how to use relational algebra to
extract some data from the following relation:
<Year, Name, Votes> where the primary key is Year+Name (composite
key). A sample table could contain the following entries:
1999 | Joe | 34
1999 | James | 45
2000 | Mike | 24
2001 | George | 17
2001 | Josh | 69

What I'm trying to do is extract all the years where we have more than
1 relation for the year. For the sample table, we need to get:
1999
2001

I tried to do in a couple of ways but I couldn't. I tried using a
projection on Year so that I can remove duplicates but then I can't
just use difference because the new relations are not compatible. Any
hints are greatly appreciated.

Thanks,
g

Reply With Quote
  #2  
Old   
Bob Badour
 
Posts: n/a

Default Re: Relational Algebra Expression - 02-09-2008 , 10:47 AM






gamehack wrote:

Quote:
Hi,

I've been trying to figure out how to use relational algebra to
extract some data from the following relation:
Year, Name, Votes> where the primary key is Year+Name (composite
key). A sample table could contain the following entries:
1999 | Joe | 34
1999 | James | 45
2000 | Mike | 24
2001 | George | 17
2001 | Josh | 69

What I'm trying to do is extract all the years where we have more than
1 relation for the year. For the sample table, we need to get:
1999
2001

I tried to do in a couple of ways but I couldn't. I tried using a
projection on Year so that I can remove duplicates but then I can't
just use difference because the new relations are not compatible. Any
hints are greatly appreciated.

Thanks,
g
Equijoin on year and inequality theta-join on name project on year.


Reply With Quote
  #3  
Old   
Bob Badour
 
Posts: n/a

Default Re: Relational Algebra Expression - 02-09-2008 , 10:47 AM



gamehack wrote:

Quote:
Hi,

I've been trying to figure out how to use relational algebra to
extract some data from the following relation:
Year, Name, Votes> where the primary key is Year+Name (composite
key). A sample table could contain the following entries:
1999 | Joe | 34
1999 | James | 45
2000 | Mike | 24
2001 | George | 17
2001 | Josh | 69

What I'm trying to do is extract all the years where we have more than
1 relation for the year. For the sample table, we need to get:
1999
2001

I tried to do in a couple of ways but I couldn't. I tried using a
projection on Year so that I can remove duplicates but then I can't
just use difference because the new relations are not compatible. Any
hints are greatly appreciated.

Thanks,
g
Equijoin on year and inequality theta-join on name project on year.


Reply With Quote
  #4  
Old   
Bob Badour
 
Posts: n/a

Default Re: Relational Algebra Expression - 02-09-2008 , 10:47 AM



gamehack wrote:

Quote:
Hi,

I've been trying to figure out how to use relational algebra to
extract some data from the following relation:
Year, Name, Votes> where the primary key is Year+Name (composite
key). A sample table could contain the following entries:
1999 | Joe | 34
1999 | James | 45
2000 | Mike | 24
2001 | George | 17
2001 | Josh | 69

What I'm trying to do is extract all the years where we have more than
1 relation for the year. For the sample table, we need to get:
1999
2001

I tried to do in a couple of ways but I couldn't. I tried using a
projection on Year so that I can remove duplicates but then I can't
just use difference because the new relations are not compatible. Any
hints are greatly appreciated.

Thanks,
g
Equijoin on year and inequality theta-join on name project on year.


Reply With Quote
  #5  
Old   
Bob Badour
 
Posts: n/a

Default Re: Relational Algebra Expression - 02-09-2008 , 10:47 AM



gamehack wrote:

Quote:
Hi,

I've been trying to figure out how to use relational algebra to
extract some data from the following relation:
Year, Name, Votes> where the primary key is Year+Name (composite
key). A sample table could contain the following entries:
1999 | Joe | 34
1999 | James | 45
2000 | Mike | 24
2001 | George | 17
2001 | Josh | 69

What I'm trying to do is extract all the years where we have more than
1 relation for the year. For the sample table, we need to get:
1999
2001

I tried to do in a couple of ways but I couldn't. I tried using a
projection on Year so that I can remove duplicates but then I can't
just use difference because the new relations are not compatible. Any
hints are greatly appreciated.

Thanks,
g
Equijoin on year and inequality theta-join on name project on year.


Reply With Quote
  #6  
Old   
Bob Badour
 
Posts: n/a

Default Re: Relational Algebra Expression - 02-09-2008 , 10:47 AM



gamehack wrote:

Quote:
Hi,

I've been trying to figure out how to use relational algebra to
extract some data from the following relation:
Year, Name, Votes> where the primary key is Year+Name (composite
key). A sample table could contain the following entries:
1999 | Joe | 34
1999 | James | 45
2000 | Mike | 24
2001 | George | 17
2001 | Josh | 69

What I'm trying to do is extract all the years where we have more than
1 relation for the year. For the sample table, we need to get:
1999
2001

I tried to do in a couple of ways but I couldn't. I tried using a
projection on Year so that I can remove duplicates but then I can't
just use difference because the new relations are not compatible. Any
hints are greatly appreciated.

Thanks,
g
Equijoin on year and inequality theta-join on name project on year.


Reply With Quote
  #7  
Old   
Bob Badour
 
Posts: n/a

Default Re: Relational Algebra Expression - 02-09-2008 , 10:47 AM



gamehack wrote:

Quote:
Hi,

I've been trying to figure out how to use relational algebra to
extract some data from the following relation:
Year, Name, Votes> where the primary key is Year+Name (composite
key). A sample table could contain the following entries:
1999 | Joe | 34
1999 | James | 45
2000 | Mike | 24
2001 | George | 17
2001 | Josh | 69

What I'm trying to do is extract all the years where we have more than
1 relation for the year. For the sample table, we need to get:
1999
2001

I tried to do in a couple of ways but I couldn't. I tried using a
projection on Year so that I can remove duplicates but then I can't
just use difference because the new relations are not compatible. Any
hints are greatly appreciated.

Thanks,
g
Equijoin on year and inequality theta-join on name project on year.


Reply With Quote
  #8  
Old   
Bob Badour
 
Posts: n/a

Default Re: Relational Algebra Expression - 02-09-2008 , 10:47 AM



gamehack wrote:

Quote:
Hi,

I've been trying to figure out how to use relational algebra to
extract some data from the following relation:
Year, Name, Votes> where the primary key is Year+Name (composite
key). A sample table could contain the following entries:
1999 | Joe | 34
1999 | James | 45
2000 | Mike | 24
2001 | George | 17
2001 | Josh | 69

What I'm trying to do is extract all the years where we have more than
1 relation for the year. For the sample table, we need to get:
1999
2001

I tried to do in a couple of ways but I couldn't. I tried using a
projection on Year so that I can remove duplicates but then I can't
just use difference because the new relations are not compatible. Any
hints are greatly appreciated.

Thanks,
g
Equijoin on year and inequality theta-join on name project on year.


Reply With Quote
  #9  
Old   
Bob Badour
 
Posts: n/a

Default Re: Relational Algebra Expression - 02-09-2008 , 10:47 AM



gamehack wrote:

Quote:
Hi,

I've been trying to figure out how to use relational algebra to
extract some data from the following relation:
Year, Name, Votes> where the primary key is Year+Name (composite
key). A sample table could contain the following entries:
1999 | Joe | 34
1999 | James | 45
2000 | Mike | 24
2001 | George | 17
2001 | Josh | 69

What I'm trying to do is extract all the years where we have more than
1 relation for the year. For the sample table, we need to get:
1999
2001

I tried to do in a couple of ways but I couldn't. I tried using a
projection on Year so that I can remove duplicates but then I can't
just use difference because the new relations are not compatible. Any
hints are greatly appreciated.

Thanks,
g
Equijoin on year and inequality theta-join on name project on year.


Reply With Quote
  #10  
Old   
Bob Badour
 
Posts: n/a

Default Re: Relational Algebra Expression - 02-09-2008 , 10:47 AM



gamehack wrote:

Quote:
Hi,

I've been trying to figure out how to use relational algebra to
extract some data from the following relation:
Year, Name, Votes> where the primary key is Year+Name (composite
key). A sample table could contain the following entries:
1999 | Joe | 34
1999 | James | 45
2000 | Mike | 24
2001 | George | 17
2001 | Josh | 69

What I'm trying to do is extract all the years where we have more than
1 relation for the year. For the sample table, we need to get:
1999
2001

I tried to do in a couple of ways but I couldn't. I tried using a
projection on Year so that I can remove duplicates but then I can't
just use difference because the new relations are not compatible. Any
hints are greatly appreciated.

Thanks,
g
Equijoin on year and inequality theta-join on name project on year.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.