《Database System Concepts(数据库系统概念)》第六版——第一次作业(第二章)

2.12

  • a.
    Π p e r s o n − n a m e ( σ c o m p a n y − n a m e = " F i r s t B a n k C o r p o r a t i o n " ( w o r k s ) ) \Pi_{person-name}(\sigma_{company-name="First Bank Corporation"}(works)) Πpersonname(σcompanyname="FirstBankCorporation"(works))

  • b.
    Π p e r s o n − n a m e , c i t y ( σ c o m p a n y − n a m e = " F i r s t B a n k C o r p o r a t i o n " ( w o r k s ⋈ e m p l o y e e ) ) \Pi_{person-name,city}(\sigma_{company-name="First Bank Corporation"}(works⋈employee)) Πpersonname,city(σcompanyname="FirstBankCorporation"(worksemployee))

  • c.
    Π p e r s o n − n a m e , s t r e e t , c i t y ( σ c o m p a n y − n a m e = " F i r s t B a n k C o r p o r a t i o n " ∧ s a l a r y > $ 10000 ( w o r k s ⋈ e m p l o y e e ) ) \Pi_{person-name,street,city}(\sigma_{company-name="First Bank Corporation" \wedge salary>\$10000 }(works⋈employee)) Πpersonname,street,city(σcompanyname="FirstBankCorporation"salary>$10000(worksemployee))

2.13

  • a.
    Π l o a n _ n u m b e r ( σ a m o u n t > $ 10000 ( l o a n ) ) \Pi_{loan\_number}(\sigma_{amount>\$10000}(loan)) Πloan_number(σamount>$10000(loan))

  • b.
    Π c u s t o m e r _ n a m e ( σ b a l a n c e > $ 6000 ( c u s t o m e r ⋈ d e p o s i t o r ⋈ a c c o u n t ) ) \Pi_{customer\_name}(\sigma_{balance>\$6000}(customer⋈depositor⋈account)) Πcustomer_name(σbalance>$6000(customerdepositoraccount))

  • c.
    Π c u s t o m e r _ n a m e ( σ b a l a n c e > $ 6000 ∧ b r a n c h _ n a m e = " U p t o w n " ( d e p o s i t o r ⋈ a c c o u n t ) ) \Pi_{customer\_name}(\sigma_{balance>\$6000\wedge branch\_name="Uptown"}(depositor⋈account)) Πcustomer_name(σbalance>$6000branch_name="Uptown"(depositoraccount))

3.1

  • a.

    select title
    from course
    where dept_name in ('Comp.','Sci.') and credit=3;
    
  • c.

    select max(salary)
    from instructor
    
  • d.

    select name
    from instructor
    where salary=(select max(salary) from instructor)
    

3.13

create table person(
    driver_id        varchar(100),
    name             varchar(100),
    address          varchar(100),
    primary key (driver_id));
    
create table car(
    license          varchar(100),
    model            varchar(100),
    year             numeric(4,0),
    primary key (license));    
    
create table accident(
    report_number    int,
    date_            date,
    location         varchar(100),
    primary key (report_number));  

create table owns(
    driver_id        varchar(100),
    license          varchar(100),
    primary key (driver_id),
    foreign key (driver_id) references person,
	foreign key (license) references car);
  
create table participated(
    report_number     int,
    license           varchar(100),
    driver_id         varchar(100),
    damage_amount     int,
    primary key (report_number,license),
    foreign key (driver_id) references person,
    foreign key (report_number) references accident,
	foreign key (license) references car);

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值