![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
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 |
#3
| |||
| |||
|
|
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 |
#4
| |||
| |||
|
|
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 |
#5
| |||
| |||
|
|
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 |
#6
| |||
| |||
|
|
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 |
#7
| |||
| |||
|
|
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 |
#8
| |||
| |||
|
|
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 |
#9
| |||
| |||
|
|
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 |
#10
| |||
| |||
|
|
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 |
![]() |
| Thread Tools | |
| Display Modes | |
| |