ALTER VIEW "DBA"."group_by"(identyfikator, nazwa, telefon /* view_column_name, ... */ )
AS
/* Type the select statement here */
SELECT id_danych,nazwa,tel from tDane_kontaktowe where id_miasta = '1' group by id_danych,tel,nazwa
ALTER VIEW "DBA"."order_by"( /* view_column_name, ... */ )
AS
/* Type the select statement here */
SELECT c.nazwa_opis,c.ilosc,c.c_cena_sprzedazy from tCzęści as c where c.c_cena_sprzedazy between 50 and 300 order by c.c_cena_sprzedazy desc
ALTER VIEW "DBA"."outer_join"(ImieKlienta, OpisOferty /* view_column_name, ... */ )
AS
SELECT p.nazwa,m.oferta from tKlienci as m right outer join tDane_kontaktowe as p on m.id_danych=p.id_danych
ALTER VIEW "DBA"."zamowienia"(Nazwa_Klienta, Ilosc_Zamówień_Łącznie /* view_column_name, ... */ )
AS
/* Type the select statement here */
SELECT p.nazwa,ilosc_zamowien_klienta(m.id_klienta) from tKlienci as m right outer join tDane_kontaktowe as p on m.id_danych=p.id_danych
ALTER PROCEDURE "DBA"."edytuj_zamowienie"(in klient int, in zestaw varchar(3), in ilosc int /* [IN | OUT | INOUT] parameter_name parameter_type [DEFAULT default_value], ... */ )
/* RESULT( column_name column_type, ... ) */
BEGIN
if(ilosc > 0) then
update azamowienie_zestawu set ilosc_zestawow = ilosc where id_klienta = klient and id_zestawu = zestaw;
commit;
else
delete from azamowienie_zestawu where id_klienta = klient and id_zestawu = zestaw;
commit;
/* Type the procedure statements here */
end if;
END
ALTER FUNCTION "DBA"."ilosc_czesci"(in idd int /* [IN] parameter_name parameter_type [DEFAULT default_value], ... */ )
RETURNS INTEGER
DETERMINISTIC
BEGIN
DECLARE ilosi INTEGER;
/* Type the function statements here */
set ilosi = (select ilosc from tCzęści where id_czesci = idd);
RETURN ilosi;
END
ALTER FUNCTION "DBA"."ilosc_zamowien_klienta"(in idd int /* [IN] parameter_name parameter_type [DEFAULT default_value], ... */ )
RETURNS INTEGER
DETERMINISTIC
BEGIN
DECLARE cddc INTEGER;
set cddc = (select count(*) from azamowienie_zestawu where id_klienta = idd);
set cddc = cddc + (select count(*) from tzamowienie_czesci where id_klienta = idd);
/* Type the function statements here */
RETURN cddc;
END
ALTER PROCEDURE "DBA"."usun_zestaw"(in idd varchar(3) /* [IN | OUT | INOUT] parameter_name parameter_type [DEFAULT default_value], ... */ )
/* RESULT( column_name column_type, ... ) */
BEGIN
delete from azamowienie_zestawu where id_zestawu = idd;
commit;
delete from tZestawy where id_zestawu = idd;
commit;
/* Type the procedure statements here */
END
ALTER PROCEDURE "DBA"."zamow_zestaw"(in id_klient int, in id_zestaw varchar(3), in ilosc int/* [IN | OUT | INOUT] parameter_name parameter_type [DEFAULT default_value], ... */ )
/* RESULT( column_name column_type, ... ) */
BEGIN
insert into azamowienie_zestawu (id_klienta,id_zestawu, ilosc_zestawow) values (id_klient,id_zestaw,ilosc);
commit;
/* Type the procedure statements here */
END