sql_6.txt

(2 KB) Pobierz
select o.*, pensja 
from osoby o natural join zatrudnienia z using(id_os) where z.do is null;  ??

=====================================================================================

create view pracownicy_a 
as
select o.* 
from osoby o, zatrudnienia z 
where o.id_os=z.id_os and z.do is null; 


select * from pracownicy_a;

====================================================================================

desc all_views
select view_pracownicy_a; from all_views;

====================================================================================

create view v_stanowiska as 
select * from stanowiska;

insert into V_stanowiska 
values (10, 'x');
select * from stanowiska;

dodaje wiersz

===================================================================================

Z tabeli osoby wypisac pierwsze dwa wiersze po posortowaniu wedlug nazwisko, imie1
 i aktualnych pracownikow

select o. * from (select * from osoby
order by nazwisko, imie1) o, zatrudnienia z
where rownum <= 2 and o.id_os=z.id_os and z.do is null;

===================================================================================

Z tabeli osoby wyswietlic wszystkie dane i roznice w dniach miedzy data urodzenia
a date osoby najstarszej

select o.*, d_ur-(select min(d_ur) from osoby) from osoby o;

===================================================================================

Wyswietlic dane osobowe aktualnych pracownikow

select * from osoby where id_os in (select id_os from zatrudnienia where do is  null);

===================================================================================

Wyszukac dane osobowe najstarszej kobiety i mezczyzny

select * from osoby o where d_ur=(select min (d_ur) from osoby where plec=o.plec);

===================================================================================

Wybrac wszystkie dane wydzialow ktore zatrudniaja atualnie wiecej niz 5 osob

select w.* from wydzialy w
where 5<(select count(*) from zatrudnienia z where z.do is null and z.id_w=w.id_w);
Zgłoś jeśli naruszono regulamin