CREATE TABLE korstnapyhkimine( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, soov VARCHAR(255), kontakt VARCHAR(30), sooviaeg DATETIME, aadress VARCHAR(100), teenuseaeg DATETIME, pyhkija VARCHAR(30), tegevus TEXT, summa DECIMAL(8, 2), tasutudaeg DATETIME ); Kasutaja sisestab päringu veebi INSERT INTO korstnapyhkimine (soov, kontakt, sooviaeg) VALUES( 'Palun pühkida korsten ja pliiditruup. Aadressiks on Kuuse 3, Valga', '56789432', NOW() ); mysql> SELECT * FROM korstnapyhkimine; +----+---------------------------------------------------------------------+----------+---------------------+---------+------------+---------+---------+-------+------------+ | id | soov | kontakt | sooviaeg | aadress | teenuseaeg | pyhkija | tegevus | summa | tasutudaeg | +----+---------------------------------------------------------------------+----------+---------------------+---------+------------+---------+---------+-------+------------+ | 1 | Palun pühkida korsten ja pliiditruup. Aadressiks on Kuuse 3, Valga | 56789432 | 2016-09-13 11:11:40 | NULL | NULL | NULL | NULL | NULL | NULL | +----+---------------------------------------------------------------------+----------+---------------------+---------+------------+---------+---------+-------+------------+ 1 row in set (0.00 sec) Sekretär määrab ära tehingu detailid (võib ka juhtuda, et kustutab päringu) UPDATE korstnapyhkimine SET aadress='Kuuse 3, Valga', teenuseaeg='2016-10-03 10:30', pyhkija='Mati Tamm' WHERE id=1; mysql> SELECT * FROM korstnapyhkimine; +----+---------------------------------------------------------------------+----------+---------------------+----------------+---------------------+-----------+---------+-------+------------+ | id | soov | kontakt | sooviaeg | aadress | teenuseaeg | pyhkija | tegevus | summa | tasutudaeg | +----+---------------------------------------------------------------------+----------+---------------------+----------------+---------------------+-----------+---------+-------+------------+ | 1 | Palun pühkida korsten ja pliiditruup. Aadressiks on Kuuse 3, Valga | 56789432 | 2016-09-13 11:11:40 | Kuuse 3, Valga | 2016-10-03 10:30:00 | Mati Tamm | NULL | NULL | NULL | +----+---------------------------------------------------------------------+----------+---------------------+----------------+---------------------+-----------+---------+-------+------------+ Vigase päringu korral: INSERT INTO korstnapyhkimine (soov, kontakt, sooviaeg) VALUES( 'Juku on loll', 'kala@kombinaat', NOW() ); +----+---------------------------------------------------------------------+----------------+---------------------+----------------+---------------------+-----------+---------+-------+------------+ | id | soov | kontakt | sooviaeg | aadress | teenuseaeg | pyhkija | tegevus | summa | tasutudaeg | +----+---------------------------------------------------------------------+----------------+---------------------+----------------+---------------------+-----------+---------+-------+------------+ | 1 | Palun pühkida korsten ja pliiditruup. Aadressiks on Kuuse 3, Valga | 56789432 | 2016-09-13 11:11:40 | Kuuse 3, Valga | 2016-10-03 10:30:00 | Mati Tamm | NULL | NULL | NULL | | 2 | Juku on loll | kala@kombinaat | 2016-09-13 11:19:06 | NULL | NULL | NULL | NULL | NULL | NULL | +----+---------------------------------------------------------------------+----------------+---------------------+----------------+---------------------+-----------+---------+-------+------------+ Sekretär eemaldab vigase päringu DELETE FROM korstnapyhkimine WHERE id=2; +----+---------------------------------------------------------------------+----------+---------------------+----------------+---------------------+-----------+---------+-------+------------+ | id | soov | kontakt | sooviaeg | aadress | teenuseaeg | pyhkija | tegevus | summa | tasutudaeg | +----+---------------------------------------------------------------------+----------+---------------------+----------------+---------------------+-----------+---------+-------+------------+ | 1 | Palun pühkida korsten ja pliiditruup. Aadressiks on Kuuse 3, Valga | 56789432 | 2016-09-13 11:11:40 | Kuuse 3, Valga | 2016-10-03 10:30:00 | Mati Tamm | NULL | NULL | NULL | +----+---------------------------------------------------------------------+----------+---------------------+----------------+---------------------+-----------+---------+-------+------------+ Korstnapühkija tegi töö ära, kirjutas kommentaari. UPDATE korstnapyhkimine SET tegevus='Truup pühitud', summa=40.35 WHERE id=1; Tellija sai ja tasus arve. UPDATE korstnapyhkimine SET tasutudaeg=NOW(); +----+---------------------------------------------------------------------+----------+---------------------+----------------+---------------------+-----------+----------------+-------+---------------------+ | id | soov | kontakt | sooviaeg | aadress | teenuseaeg | pyhkija | tegevus | summa | tasutudaeg | +----+---------------------------------------------------------------------+----------+---------------------+----------------+---------------------+-----------+----------------+-------+---------------------+ | 1 | Palun pühkida korsten ja pliiditruup. Aadressiks on Kuuse 3, Valga | 56789432 | 2016-09-13 11:11:40 | Kuuse 3, Valga | 2016-10-03 10:30:00 | Mati Tamm | Truup pühitud | 40.35 | 2016-09-13 11:24:59 | +----+---------------------------------------------------------------------+----------+---------------------+----------------+---------------------+-----------+----------------+-------+---------------------+ Teenus läbi teha mitme erimoelise kirjega. Pärast mõned loendamised ja kokkuvõtvad arvutused (nt. mitu pühkimist Matil, milline kogusumma)