我正试图规范这种关系:
film_year film_name critic_id critic_name cinemas_debut score
2004 I robot 111 John NY_cinema, LA_cinema 4
2004 I robot 222 Mathiew NY_cinema, LA_cinema 5
哪里......
我无法将关系转换为3FN。这是我尝试过的:
至1NF:没有重复元素或元素组:
film_year film_name critic_id critic_name cinemas_debut score
2004 I robot 111 John NY_cinema 4
2004 I robot 222 Mathiew LA_cinema 5
2004 I robot 111 John NY_cinema 4
2004 I robot 222 Mathiew LA_cinema 5
To 2NF:对连锁密钥没有部分依赖关系:我将其视为PK film_year, film_name, critic_id, cinemas_debut
。然后是critic_name
和score
ara部分家属,我将这些属性与其决定因素的副本脱离关系:
critics ( critic_id (pk), critic_name )
reviews(film_year (pk), film_name (pk), critic_id (pk), score)
但我不知道如何处理结果关系:
film_year film_name critic_id cinemas_debut
2004 I robot 111 NY_cinema
2004 I robot 222 LA_cinema
2004 I robot 111 NY_cinema
2004 I robot 222 LA_cinema
此时我不知道如何对这种结果关系应用归一化。我正在寻找的是一步一步规范化。我不需要最终结果。我不想学习规范化规则,因为我需要逐步规范化。
答案 0 :(得分:1)
这将是你的3NF,但是我还没有测试过这些约束。
film (name, year) PK > (name, year) critic (id, name) PK > id film_critic (film_name, film_year, critic_id, score) PK > (film_name, film_year, critic_id) FK > (film_name, film_year) & critic_id cinema (name) PK > name film_cinema (film_name, film_year, cinema_name) PK > (film_name, film_year, cinema_name) FK > (film_name, film_year) & cinema_name
使用代理键而不是引用电影名称和年份(对于电影院来说)也会更容易。
film (id, name, year) PK > id critic (id, name) PK > id film_critic (film_id, critic_id, score) PK > (film_id, critic_id) FK > film_id & critic_id cinema (id, name) PK > id film_cinema (film_id, cinema_id) PK > (film_id, cinema_id) FK > film_id & cinema_id