【问题标题】:Relational algebra notation of the employees in the same Department as employee 3与员工 3 在同一部门的员工的关系代数表示法
【发布时间】:2012-10-11 07:03:22
【问题描述】:

请大家解释一下

ρ emp2.surname,emp2.forenames (
    σ employee.empno = 3 ^ employee.depno = emp2.depno (
        employee × (ρemp2employee)
    )
)

【问题讨论】:

    标签: database relational-algebra


    【解决方案1】:

    该查询将“员工#3”与另一个“员工”联系起来,因为他们都在同一个部门。因此,您需要两个员工列表(咳咳,表格)。由于您有相同事物的两个实例,因此您需要至少对其中一个实例进行别名(技术上重命名)。两个表之间最通用的关系是笛卡尔积。因此,既然您构建了笛卡尔积,您必须将 a) 第一个表中的员工限制为 #3,以及 b) 两个表中属于同一部门的员工。最后一步是仅选择与所提出问题相关的员工属性。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多