🗒️FIT 2094 class test 1

Cs, Go!

FIT 2094|2026-1-18|最后更新: 2026-1-20|
Place
人员
  • Sample test 题目以及答案的对照。
(sample test 官方打开方式为safe exam browser,不方便对照答案查看)
 
sample test 重点汇总:
  • class test 结构:
    • 时间:85 min
      主题
      分值 / marks
      时间分配(根据分值)/ min
      relational algebra
      10
      20
      normalisation
      10
      20
      data modelling
      20
      40
      (真实考试结构可能有出入)
  • sample test 涉及到的相关知识点:
🎇
任何 relational algebra 的结果都是 relation。就算是先 SELECT 后 PROJECT 后只包含一个 attribute 也是 relation。
notion image
 
例子:
我们想要知道 prop_id 为 12345 的property owner 还有哪些property,以及显示所有相关信息
r1 = π owner_id (σ prop_id = 12345 (PROPERTY))
 
r2 = r1 ⨝ (PROPERTY)
r2 = σ owner_id = r1(PROPERTY)
 
  1. relational algebra 保证高效的规则
    1. 先做选择(σ)→ 尽早减少 tuple 数量
      再做投影(π)→ 删除不需要的属性,但要保留后续所需属性
      推迟连接(⨝)→ Join 很昂贵,必须在 σ、π 之后
      避免笛卡尔积(×)→ 几乎总是最低效
      选择条件越具体越好 → 减少中间结果大小
      只保留必要属性参与 join→ 降低 join 成本
      顺序: σ → π → (∪ ∩ −) → ⨝
       
  1. normalisation
    1. form → UNF
      注意事项
      1. nested repeating groups。如果是 repeating group,大概率会另画一个table。注意nested repeating group 和 non-atomic attribute 的区别。
        1. 但是如果即是non-atomic attribute 又是 repeating group,那么可能不会画)具体看下面的例子。
          不要多想,UNF 要完全根据所给内容来,是比较扁平化的结构,不要自己往上面加结构。
           
          Repeating groups 通常表现为可重复出现的多组数据结构,应被建模为独立的关系;
          而 non-atomic attribute 若未体现为重复数据结构,则不视为 repeating group,不应单独建表。
       
      notion image
      标成方形的都是 repeating group。蓝色的比较明显,红色的并没有单开一个表格,它是 non-atomic 的。
      notion image
      黄色圆形的就不是 repeating group 只是 non-atomic attribute
       
      UNF → 1NF
      注意事项
      1. 鉴别partial dependencies 的时候,CK 必须是由大于一个attri组成的。
      1. 主实体的 PK 会成为新实体 PK 的一部分;
      ‼️‼️ 新实体中的部分 PK 不可以成为主实体的 FK 。不管 main entity 的 composite PK 有多长都不行。
      1NF → 2NF
      注意事项
      • Non-key attributes are attributes that are not part of any candidate key.
      • Partial dependencies are defined with respect to composite candidate keys, not merely the chosen primary key.
      • During the transformation from 1NF to 2NF, the PKs of the newly created relations become FKs in the remaining relation. This differs from the UNF to 1NF transformation, where the original PK is propagated into the new relation as part of a composite PK.
      2NF → 3NF
      注意事项
      新关系中,决定属性作为 PK ,而原关系中保留其作为 FK
  1. data modelling
    1. 考试中想要省点时间找entity和key,可以注意这几个关键词:assignedidentifiedidnumber。直接command + F 搜索就好了。但是不代表这样找到的entity和key就是最后结果,还以要仔细读材料。
 
Loading...