Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
blanc-de-poulet
Starting Member
4 Posts |
Posted - 2005-04-06 : 19:50:48
|
| ok this is prolly the biggest noob question around but hey...I m asked to write a statement to show that the data in R(A,B,C) supports the FD A -> Band I wroteSELECT count(*)FROM R A1, R A2WHERE a1.A=A2.A AND A1.B != A2.B;which is wrongSomeone?thanks,JD |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2005-04-06 : 19:51:44
|
| What does this mean: R(A,B,C) supports the FD A -> B?Tara |
 |
|
|
blanc-de-poulet
Starting Member
4 Posts |
Posted - 2005-04-06 : 21:10:39
|
| show that the data in the relation R(A,B,C) supports the supposed Functional Dependency A -> B |
 |
|
|
blanc-de-poulet
Starting Member
4 Posts |
Posted - 2005-04-06 : 21:15:30
|
| Oh did i misinterpreted your answer?hmmI thought could answer the original question by"If 2 tuples in R agree in their A attribute, then their B attribute should also be the same" |
 |
|
|
byrmol
Shed Building SQL Farmer
1591 Posts |
Posted - 2005-04-06 : 21:59:18
|
| Let's use a "real life" example...Given R = Employee (EmployeeID PK, LastName, FirstName)The FD: (EmployeeID -> LastName) is saying that for any value of EmployeeID there is just one LastName value. Or "If I know the EmployeeID, I must know the LastName". It also says that another EmployeeID may also have the same LastName.So.... We need to write a query that verifies the saying "An EmployeeID value has only one LastName value"If any rows are returned then the FD does not hold...SELECT EmployeeID, COUNT(LastName) AS LastNameCNTFROM EmployeesGROUP BY EmployeeIDHAVING COUNT(LastName) != 1DavidMA front-end is something that tries to violate a back-end. |
 |
|
|
blanc-de-poulet
Starting Member
4 Posts |
Posted - 2005-04-06 : 23:15:17
|
| that is exactly what I was looking for. The xplanation is also perfectly clear.Thank you |
 |
|
|
|
|
|
|
|