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)) Πperson−name(σcompany−name="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)) Πperson−name,city(σcompany−name="FirstBankCorporation"(works⋈employee)) -
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)) Πperson−name,street,city(σcompany−name="FirstBankCorporation"∧salary>$10000(works⋈employee))
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(customer⋈depositor⋈account)) -
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>$6000∧branch_name="Uptown"(depositor⋈account))
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);