Контрольная работа: Інформаційна система будівельної організації
go
alter table tblOrder add constraint FK_TBLORDER_RL_3_TBLCHARO foreign key (ChaRoad_id) references tblChaRoad (ChaRoad_id)
go
alter table tblOrder add constraint FK_TBLORDER_RL_4_TBLCHABU foreign key (ChaBuild_id) references tblChaBuild (ChaBuild_id)
go
alter table tblReport add constraint FK_TBLREPOR_RL_17_TBLORDER foreign key (Order_id) references tblOrder (Order_id)
go
alter table tblWorkers add constraint FK_TBLWORKE_RL_12_TBLBRIGA foreign key (Brigade_id) references tblBrigade (Brigade_id)
go
Виконання запитів
1. Одержати перелік будівельних правлінь або ділянок та їх керівників
select o.buildmanagement, o.nplot_id, n.head
from tblorder as o, tblnplot as n
where o.nplot_id=n.nplot_id
2. Одержати список фахівців інженерно-технічного складу позначеної ділянки або будівельного правління із зазначенням їх посад
select distinct(o.buildmanagement), o.nplot_id, t.engineers, t.technology, t.technics
from tblorder as o, tblnplot as n, tbltech as t
where o.nplot_id=3
3. Одержати перелік об'єктів, що зводяться зазначеним будівельним правлінням або ділянкою, і графіки їхнього зведення
select distinct(o.object), o.buildmanagement, o.nplot_id, g.jobtype, g.termperformance
from tblorder as o, tblgrafics as g
where o.order_id=g.order_id
4. Одержати склад бригад, що працювали (працюють) на будівництві зазначеного об'єкта
select o.object, w.bricklayer, w.concrete, w.handler, w.welders, w.electricity, w.driver, w.locksmiths, w.workers_id
from tblorder as o, tblworkers as w
where o.nplot_id=w.nplot_id
5. Одержати перелік будівельної техніки, наданої зазначеному будівельному правлінню
select o.buildmanagement, m.bulldozers, m.cranes, m.excavator, 3
from tblorder as o, tblmachines as m