【edited】 Constraints on database -
i have following table called students. if want put constraint -- each state, there no more 2 students can come same state, how express such constraint in relational algebra?
name | hometown | gender ----------------------------------- bob | nyc | male alice | washington d.c| female linda | london | female peter | miami | male amy | philadelphia | female lucy | nyc | female james | albany | male jason | los angeles | male cindy | salt lake city| female jackson| princeton | male judy | seattle | female marcia | san francisco | female steve | nyc | male john | miami | male
you're going need relation providing state each town. join table (on town) , give state. group result state , count occurrences, constraining count less or equal two. haven't provided required relation or relation names, can't give algebra, should find helps homework done.
Comments
Post a Comment