CREATE TABLE Klient (
   id INTEGER PRIMARY KEY,
   imie VARCHAR(30) NOT NULL,
   nazwisko VARCHAR(40) NOT NULL
 );

 CREATE TABLE Konto (
   numer INTEGER PRIMARY KEY,
   idklienta INTEGER NOT NULL REFERENCES Klient,
   saldo INTEGER  DEFAULT 0 NOT NULL
 );

 CREATE TABLE Przelew (
   nadawca INTEGER NOT NULL REFERENCES Konto,
   odbiorca INTEGER NOT NULL REFERENCES Konto,
   kwota INTEGER NOT NULL,
   data DATE NOT NULL,
   PRIMARY KEY (nadawca, odbiorca, data)
 );

-- This DDL was reverse engineered by
-- TOra, Version 2.1.4.(4680svn)
--
-- at:   fasola
-- from: :1521:ORCL.LOCAL , an Oracle 1102000200 database
--
-- on:   pon. lis 4 03:42:07 2013
--
-- Generating CREATE statement for:
-- TABLE CONTENTS:KOL.KLIENT
-- TABLE CONTENTS:KOL.KONTO
-- TABLE CONTENTS:KOL.PRZELEW

INSERT INTO klient (ID,IMIE,NAZWISKO) VALUES ('1','Jan','Abacki');
INSERT INTO klient (ID,IMIE,NAZWISKO) VALUES ('2','Janina','Babacka');
INSERT INTO klient (ID,IMIE,NAZWISKO) VALUES ('3','Adam','Cabacki');
INSERT INTO klient (ID,IMIE,NAZWISKO) VALUES ('4','Anna','Dabacka');
INSERT INTO klient (ID,IMIE,NAZWISKO) VALUES ('5','Bartosz','Ebacki');
INSERT INTO klient (ID,IMIE,NAZWISKO) VALUES ('6','Barbara','Fabacka');
INSERT INTO klient (ID,IMIE,NAZWISKO) VALUES ('7','Celiusz','Gabacki');
INSERT INTO klient (ID,IMIE,NAZWISKO) VALUES ('8','Celina','Habacka');
INSERT INTO klient (ID,IMIE,NAZWISKO) VALUES ('9','Dariusz','Ibacki');
INSERT INTO klient (ID,IMIE,NAZWISKO) VALUES ('10','Dominika','Kabacka');
INSERT INTO klient (ID,IMIE,NAZWISKO) VALUES ('11','Eugeniusz','Labacki');
INSERT INTO klient (ID,IMIE,NAZWISKO) VALUES ('12','Eliza','Mabacka');
INSERT INTO klient (ID,IMIE,NAZWISKO) VALUES ('13','Fabian','Nabacki');
INSERT INTO klient (ID,IMIE,NAZWISKO) VALUES ('14','Felicja','Obacka');
COMMIT;

INSERT INTO konto (NUMER,IDKLIENTA,SALDO) VALUES ('1','1','300');
INSERT INTO konto (NUMER,IDKLIENTA,SALDO) VALUES ('100','1','45');
INSERT INTO konto (NUMER,IDKLIENTA,SALDO) VALUES ('1000','1','5000');
INSERT INTO konto (NUMER,IDKLIENTA,SALDO) VALUES ('2','2','5');
INSERT INTO konto (NUMER,IDKLIENTA,SALDO) VALUES ('200','2','450');
INSERT INTO konto (NUMER,IDKLIENTA,SALDO) VALUES ('3','3','-1000');
INSERT INTO konto (NUMER,IDKLIENTA,SALDO) VALUES ('300','3','15');
INSERT INTO konto (NUMER,IDKLIENTA,SALDO) VALUES ('3000','3','689');
INSERT INTO konto (NUMER,IDKLIENTA,SALDO) VALUES ('4','4','1500');
INSERT INTO konto (NUMER,IDKLIENTA,SALDO) VALUES ('5','5','3218');
INSERT INTO konto (NUMER,IDKLIENTA,SALDO) VALUES ('500','5','-10');
INSERT INTO konto (NUMER,IDKLIENTA,SALDO) VALUES ('5000','5','550');
INSERT INTO konto (NUMER,IDKLIENTA,SALDO) VALUES ('50000','5','826');
INSERT INTO konto (NUMER,IDKLIENTA,SALDO) VALUES ('7','7','871');
INSERT INTO konto (NUMER,IDKLIENTA,SALDO) VALUES ('700','7','1580');
INSERT INTO konto (NUMER,IDKLIENTA,SALDO) VALUES ('8','8','33');
INSERT INTO konto (NUMER,IDKLIENTA,SALDO) VALUES ('800','8','3333');
INSERT INTO konto (NUMER,IDKLIENTA,SALDO) VALUES ('8008','8','999');
INSERT INTO konto (NUMER,IDKLIENTA,SALDO) VALUES ('9','9','2460');
INSERT INTO konto (NUMER,IDKLIENTA,SALDO) VALUES ('940','9','334455');
INSERT INTO konto (NUMER,IDKLIENTA,SALDO) VALUES ('10','10','9');
INSERT INTO konto (NUMER,IDKLIENTA,SALDO) VALUES ('10001','10','400');
INSERT INTO konto (NUMER,IDKLIENTA,SALDO) VALUES ('100005','10','321');
INSERT INTO konto (NUMER,IDKLIENTA,SALDO) VALUES ('101005','10','6789');
INSERT INTO konto (NUMER,IDKLIENTA,SALDO) VALUES ('11','11','86');
INSERT INTO konto (NUMER,IDKLIENTA,SALDO) VALUES ('1100','11','9342');
INSERT INTO konto (NUMER,IDKLIENTA,SALDO) VALUES ('12','12','98765');
INSERT INTO konto (NUMER,IDKLIENTA,SALDO) VALUES ('12001','12','876');
INSERT INTO konto (NUMER,IDKLIENTA,SALDO) VALUES ('12001200','12','7659');
INSERT INTO konto (NUMER,IDKLIENTA,SALDO) VALUES ('12121212','12','97531');
INSERT INTO konto (NUMER,IDKLIENTA,SALDO) VALUES ('14','14','0');
INSERT INTO konto (NUMER,IDKLIENTA,SALDO) VALUES ('1400','14','14');
INSERT INTO konto (NUMER,IDKLIENTA,SALDO) VALUES ('141414','14','553');
COMMIT;

INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('1','2','100',TO_DATE('2000-10-20 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('100','1000','450',TO_DATE('2001-01-02 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('1','300','1010',TO_DATE('2011-12-05 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('1','5','20',TO_DATE('2005-05-05 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('1','7','458',TO_DATE('2007-07-06 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('1','200','3400',TO_DATE('2006-02-03 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('7','7','401',TO_DATE('2007-06-04 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('1','1000','254',TO_DATE('2011-10-08 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('1','200','34',TO_DATE('2012-10-07 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('1','200','6000',TO_DATE('2008-01-07 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('1','300','500',TO_DATE('2009-03-08 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('1','3000','909',TO_DATE('2001-05-08 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('4','1','88',TO_DATE('2005-06-10 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('1','500','954',TO_DATE('2002-05-31 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('1','141414','989',TO_DATE('2003-05-23 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('1400','1','3887',TO_DATE('2003-05-24 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('14','1','876',TO_DATE('2004-02-23 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('12121212','2','939',TO_DATE('2001-06-30 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('12121212','1','88',TO_DATE('2001-07-04 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('12001','5','238',TO_DATE('2001-08-03 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('12001200','1','405',TO_DATE('2009-09-07 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('12','300','222',TO_DATE('2002-02-02 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('12','1','2333',TO_DATE('2012-10-03 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('12','10','23',TO_DATE('2002-03-09 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('12','1','28',TO_DATE('2010-12-09 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('1100','1','35',TO_DATE('2003-03-08 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('50000','2','56',TO_DATE('2004-09-05 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('700','100005','1101',TO_DATE('2002-10-07 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('1','700','78',TO_DATE('2003-03-18 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('101005','1','87',TO_DATE('2007-02-07 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('1100','100','778',TO_DATE('2010-02-09 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('5000','1','31',TO_DATE('2006-06-06 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('1100','9','90',TO_DATE('2001-07-06 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('3','1','400',TO_DATE('2008-04-03 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('1','200','52',TO_DATE('2007-02-09 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('8008','11','965',TO_DATE('2012-07-07 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('3000','1','11',TO_DATE('2010-03-09 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('9','100005','45',TO_DATE('2010-06-09 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('1400','3','77',TO_DATE('2010-10-10 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('50000','200','93',TO_DATE('2011-08-23 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('1','8008','2',TO_DATE('2011-11-03 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('1','12','1',TO_DATE('1999-12-08 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('1','3000','10',TO_DATE('1997-12-10 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('100','500','98',TO_DATE('2000-12-25 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('50000','100','999',TO_DATE('2000-02-02 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('8','1','78',TO_DATE('2000-01-03 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('9','4','88',TO_DATE('2000-02-08 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('1','700','752',TO_DATE('2000-02-09 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('8008','1','33',TO_DATE('2000-06-04 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('3','3000','500',TO_DATE('1990-04-06 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('2','12121212','77',TO_DATE('2000-12-03 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('100005','1','56',TO_DATE('2000-02-05 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('1','12001','55',TO_DATE('2000-03-17 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('1','10001','670',TO_DATE('2000-06-23 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('940','1','1888',TO_DATE('2000-04-20 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('800','1','787',TO_DATE('2001-05-27 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('11','1','23',TO_DATE('2000-11-07 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('1','5000','3',TO_DATE('2000-12-08 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('1','10','6',TO_DATE('2000-11-08 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('50000','1','6000',TO_DATE('2012-08-26 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('9','1','356',TO_DATE('2013-04-22 00:00:00','YYYY-MM-DD HH24:MI:SS'));
INSERT INTO przelew (NADAWCA,ODBIORCA,KWOTA,DATA) VALUES ('100','1','10',TO_DATE('2012-04-04 00:00:00','YYYY-MM-DD HH24:MI:SS'));
COMMIT;
