Sample Header Ad - 728x90

How to express functional dependency in relational calculus and SQL?

0 votes
1 answer
494 views
I want to express in relational calculus and SQL the following functional dependency associated with Vote. This is the first time I try to implement it in actual SQL and relational calculus. Vote: #PollID, #ElectorID → VoteID From the following relational scheme: - Candidate(**CandidateID**, Name, PoliticalGroup) - Poll(**PollID**, Date, Round) - Elector(**ElectorID**, Name, #PollingStationID) - Vote(**VoteID**,#PollID, #CandidateID, #ElectorID) ## My attempt ### 1. In relational calculus dependance ### 2. In SQL CREATE ASSERTION Vote BEFORE COMMIT t.voteID FROM Vote t CHECK u.CandidateID FROM Candidate u WHERE EXISTS v.PollID FROM Poll v WHERE u.ElectorID=t.ElectorID AND t.PollID=v.PollID
Asked by Revolucion for Monica (677 rep)
May 8, 2016, 10:43 PM
Last activity: May 2, 2018, 04:51 PM