Mariadb [nafaqaxorlardb]> create function pensiya hisoblash (son int)


Download 19.5 Kb.
Sana25.11.2021
Hajmi19.5 Kb.
#177127
Bog'liq
funcsiya yaratilgan, foydalanilgan kodi


MariaDB [nafaqaxorlardb]> create function pensiya_hisoblash (son int)

-> returns int

-> begin

-> declare res int;

-> set res = 0;

-> set res = son * 238610;

-> return res;

-> end;$$

ERROR 1418 (HY000): This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)

MariaDB [nafaqaxorlardb]> create function pensiya_hisoblash (son int)

-> returns int

-> deterministic

-> begin

-> declare res int;

-> set res = 0;

-> set res = son * 238610;

-> return res;

-> end; $$

ERROR 2006 (HY000): MySQL server has gone away

No connection. Trying to reconnect...

Connection id: 13

Current database: nafaqaxorlardb

Query OK, 0 rows affected (0.026 sec)

MariaDB [nafaqaxorlardb]> select pensiya_hisoblash(3);

-> $$

+----------------------+



| pensiya_hisoblash(3) |

+----------------------+

| 715830 |

+----------------------+

1 row in set (0.047 sec)

MariaDB [nafaqaxorlardb]> desc pensioner;

-> $$

+-------------------------+--------------+------+-----+---------+----------------+



| Field | Type | Null | Key | Default | Extra |

+-------------------------+--------------+------+-----+---------+----------------+

| id | int(11) | NO | PRI | NULL | auto_increment |

| fio | varchar(100) | NO | | NULL | |

| tugilgan_sana | date | NO | | NULL | |

| tumani | int(11) | NO | MUL | NULL | |

| pensiyagacha_lav | int(11) | NO | MUL | NULL | |

| staji | int(11) | NO | | NULL | |

| pensiya_tayinlangan_yil | int(11) | NO | | NULL | |

| pul_shakli | int(11) | NO | MUL | NULL | |

| summasi | int(11) | NO | MUL | NULL | |

+-------------------------+--------------+------+-----+---------+----------------+

9 rows in set (0.032 sec)

MariaDB [nafaqaxorlardb]> create function pensioner_kiritish (fio varchar(100), tugilgan_sana date, tumani int, pensiyagacha_lav int, staji int, pensiya_tayinlangan_yil int, pul_shakli int, summasi int)

-> returns text

-> deterministic

-> begin

-> insert into pensioner (fio,tugilgan_sana,tumani,pensiyagacha_lav,staji,pensiya_tayinlangan_yil,pul_shakli,summasi) values (fio,tugilgan_sana,tumani,pensiyagacha_lav,staji,pensiya_tayinlangan_yil,pul_shakli,summasi);

-> return 'Muvaffaqiyatli kiritildi!';

-> end; $$

ERROR 2013 (HY000): Lost connection to MySQL server during query

MariaDB [nafaqaxorlardb]> create function pensioner_kiritish (fio varchar(100), tugilgan_sana date, tumani int, pensiyagacha_lav int, staji int, pensiya_tayinlangan_yil int, pul_shakli int, summasi int)

-> returns text

-> deterministic

-> begin

-> insert into pensioner (fio,tugilgan_sana,tumani,pensiyagacha_lav,staji,pensiya_tayinlangan_yil,pul_shakli,summasi) values (fio,tugilgan_sana,tumani,pensiyagacha_lav,staji,pensiya_tayinlangan_yil,pul_shakli,summasi);

-> return 'Muvaffaqiyatli kiritildi!';

-> end; $$

ERROR 2006 (HY000): MySQL server has gone away

No connection. Trying to reconnect...

Connection id: 14

Current database: nafaqaxorlardb

Query OK, 0 rows affected (0.072 sec)

MariaDB [nafaqaxorlardb]> select * from pensioner;

-> $$

+----+-------+---------------+--------+------------------+-------+-------------------------+------------+---------+



| id | fio | tugilgan_sana | tumani | pensiyagacha_lav | staji | pensiya_tayinlangan_yil | pul_shakli | summasi |

+----+-------+---------------+--------+------------------+-------+-------------------------+------------+---------+

| 1 | fio1 | 1949-12-17 | 1 | 2 | 20 | 2009 | 1 | 5 |

| 2 | fio1 | 1949-12-17 | 1 | 2 | 20 | 2009 | 1 | 5 |

| 3 | fio2 | 1951-01-01 | 1 | 1 | 15 | 2011 | 2 | 7 |

| 4 | fio3 | 1950-01-02 | 3 | 5 | 14 | 2006 | 2 | 4 |

| 5 | fio4 | 1953-01-01 | 1 | 1 | 15 | 2011 | 2 | 7 |

| 6 | fio5 | 1950-01-02 | 3 | 5 | 14 | 2006 | 2 | 4 |

| 7 | fio6 | 1955-12-12 | 1 | 1 | 12 | 2015 | 2 | 7 |

| 8 | fio7 | 1956-06-05 | 5 | 13 | 6 | 2001 | 1 | 1 |

| 9 | fio8 | 1954-06-06 | 2 | 7 | 13 | 2015 | 1 | 6 |

| 10 | fio9 | 1955-12-05 | 4 | 6 | 12 | 2001 | 2 | 4 |

| 11 | fio10 | 1954-03-12 | 3 | 4 | 11 | 2002 | 1 | 6 |

| 12 | fio11 | 1948-03-08 | 6 | 9 | 24 | 2006 | 2 | 4 |

| 13 | fio12 | 1952-03-08 | 8 | 7 | 4 | 2009 | 2 | 7 |

| 14 | fio13 | 1954-03-08 | 5 | 4 | 6 | 2011 | 2 | 7 |

| 15 | fio14 | 1954-08-08 | 2 | 5 | 30 | 2019 | 1 | 6 |

| 16 | fio15 | 1956-08-08 | 1 | 8 | 15 | 2012 | 2 | 4 |

| 17 | fio16 | 1958-08-08 | 2 | 12 | 13 | 2008 | 1 | 5 |

| 18 | fio17 | 1953-01-01 | 1 | 1 | 15 | 2011 | 2 | 7 |

| 19 | fio18 | 1950-01-02 | 3 | 5 | 14 | 2006 | 2 | 4 |

| 20 | fio19 | 1955-12-12 | 1 | 1 | 12 | 2015 | 2 | 7 |

| 21 | fio20 | 1956-06-05 | 5 | 13 | 6 | 2001 | 1 | 1 |

| 22 | fio21 | 1954-06-06 | 2 | 7 | 13 | 2015 | 1 | 6 |

| 23 | fio22 | 1955-12-05 | 4 | 6 | 12 | 2001 | 2 | 4 |

| 54 | fio23 | 1953-01-01 | 3 | 3 | 14 | 2011 | 1 | 4 |

| 55 | fio24 | 1950-01-02 | 7 | 3 | 15 | 2006 | 2 | 5 |

| 56 | fio25 | 1955-12-12 | 6 | 4 | 13 | 2015 | 1 | 3 |

| 57 | fio26 | 1956-06-05 | 4 | 3 | 14 | 2001 | 1 | 1 |

| 58 | fio27 | 1954-06-06 | 6 | 7 | 25 | 2015 | 1 | 6 |

| 59 | fio28 | 1955-12-05 | 1 | 6 | 32 | 2000 | 2 | 3 |

+----+-------+---------------+--------+------------------+-------+-------------------------+------------+---------+

29 rows in set (0.001 sec)

MariaDB [nafaqaxorlardb]> select pensioner_kiritish ('Eshmat','1960-12-12',2,3,25,2011,2,6);

-> $$

+------------------------------------------------------------+



| pensioner_kiritish ('Eshmat','1960-12-12',2,3,25,2011,2,6) |

+------------------------------------------------------------+

| Muvaffaqiyatli kiritildi! |

+------------------------------------------------------------+

1 row in set (0.419 sec)

MariaDB [nafaqaxorlardb]> select * from pensioner;

-> $$

+----+--------+---------------+--------+------------------+-------+-------------------------+------------+---------+



| id | fio | tugilgan_sana | tumani | pensiyagacha_lav | staji | pensiya_tayinlangan_yil | pul_shakli | summasi |

+----+--------+---------------+--------+------------------+-------+-------------------------+------------+---------+

| 1 | fio1 | 1949-12-17 | 1 | 2 | 20 | 2009 | 1 | 5 |

| 2 | fio1 | 1949-12-17 | 1 | 2 | 20 | 2009 | 1 | 5 |

| 3 | fio2 | 1951-01-01 | 1 | 1 | 15 | 2011 | 2 | 7 |

| 4 | fio3 | 1950-01-02 | 3 | 5 | 14 | 2006 | 2 | 4 |

| 5 | fio4 | 1953-01-01 | 1 | 1 | 15 | 2011 | 2 | 7 |

| 6 | fio5 | 1950-01-02 | 3 | 5 | 14 | 2006 | 2 | 4 |

| 7 | fio6 | 1955-12-12 | 1 | 1 | 12 | 2015 | 2 | 7 |

| 8 | fio7 | 1956-06-05 | 5 | 13 | 6 | 2001 | 1 | 1 |

| 9 | fio8 | 1954-06-06 | 2 | 7 | 13 | 2015 | 1 | 6 |

| 10 | fio9 | 1955-12-05 | 4 | 6 | 12 | 2001 | 2 | 4 |

| 11 | fio10 | 1954-03-12 | 3 | 4 | 11 | 2002 | 1 | 6 |

| 12 | fio11 | 1948-03-08 | 6 | 9 | 24 | 2006 | 2 | 4 |

| 13 | fio12 | 1952-03-08 | 8 | 7 | 4 | 2009 | 2 | 7 |

| 14 | fio13 | 1954-03-08 | 5 | 4 | 6 | 2011 | 2 | 7 |

| 15 | fio14 | 1954-08-08 | 2 | 5 | 30 | 2019 | 1 | 6 |

| 16 | fio15 | 1956-08-08 | 1 | 8 | 15 | 2012 | 2 | 4 |

| 17 | fio16 | 1958-08-08 | 2 | 12 | 13 | 2008 | 1 | 5 |

| 18 | fio17 | 1953-01-01 | 1 | 1 | 15 | 2011 | 2 | 7 |

| 19 | fio18 | 1950-01-02 | 3 | 5 | 14 | 2006 | 2 | 4 |

| 20 | fio19 | 1955-12-12 | 1 | 1 | 12 | 2015 | 2 | 7 |

| 21 | fio20 | 1956-06-05 | 5 | 13 | 6 | 2001 | 1 | 1 |

| 22 | fio21 | 1954-06-06 | 2 | 7 | 13 | 2015 | 1 | 6 |

| 23 | fio22 | 1955-12-05 | 4 | 6 | 12 | 2001 | 2 | 4 |

| 54 | fio23 | 1953-01-01 | 3 | 3 | 14 | 2011 | 1 | 4 |

| 55 | fio24 | 1950-01-02 | 7 | 3 | 15 | 2006 | 2 | 5 |

| 56 | fio25 | 1955-12-12 | 6 | 4 | 13 | 2015 | 1 | 3 |

| 57 | fio26 | 1956-06-05 | 4 | 3 | 14 | 2001 | 1 | 1 |

| 58 | fio27 | 1954-06-06 | 6 | 7 | 25 | 2015 | 1 | 6 |

| 59 | fio28 | 1955-12-05 | 1 | 6 | 32 | 2000 | 2 | 3 |

| 60 | Eshmat | 1960-12-12 | 2 | 3 | 25 | 2011 | 2 | 6 |

+----+--------+---------------+--------+------------------+-------+-------------------------+------------+---------+

30 rows in set (0.001 sec)

MariaDB [nafaqaxorlardb]> show tables;

-> $$


+--------------------------+

| Tables_in_nafaqaxorlardb |

+--------------------------+

| kategoriyasi |

| lavozim |

| naqd_pensiya |

| pensioner |

| plastik_pensiya |

| pul_shakli |

| summa |

| tumanlar |

| umumiy |

| zapros |

+--------------------------+

10 rows in set (0.025 sec)

MariaDB [nafaqaxorlardb]> select * from umumiy;

-> $$

+----+--------+---------------+------------------+---------------------+-------+-------------------------+---------+---------+



| id | fio | tugilgan_sana | tuman_nomi | lav_nomi | staji | pensiya_tayinlangan_yil | turi | summa |

+----+--------+---------------+------------------+---------------------+-------+-------------------------+---------+---------+

| 1 | fio1 | 1949-12-17 | Beruniy tumani | Uqituvchi | 20 | 2009 | Plastik | 1193050 |

| 2 | fio1 | 1949-12-17 | Beruniy tumani | Uqituvchi | 20 | 2009 | Plastik | 1193050 |

| 9 | fio8 | 1954-06-06 | Turtkul tumani | Farrosh | 13 | 2015 | Plastik | 1431660 |

| 15 | fio14 | 1954-08-08 | Turtkul tumani | Buxgalter | 30 | 2019 | Plastik | 1431660 |

| 17 | fio16 | 1958-08-08 | Turtkul tumani | Xujalik mudiri | 13 | 2008 | Plastik | 1193050 |

| 22 | fio21 | 1954-06-06 | Turtkul tumani | Farrosh | 13 | 2015 | Plastik | 1431660 |

| 11 | fio10 | 1954-03-12 | Ellikqala tumani | Xamshira | 11 | 2002 | Plastik | 1431660 |

| 54 | fio23 | 1953-01-01 | Ellikqala tumani | Doktor | 14 | 2011 | Plastik | 954440 |

| 57 | fio26 | 1956-06-05 | Amudaryo tumani | Doktor | 14 | 2001 | Plastik | 238610 |

| 8 | fio7 | 1956-06-05 | Nukus tumani | Ish yurituvchi | 6 | 2001 | Plastik | 238610 |

| 21 | fio20 | 1956-06-05 | Nukus tumani | Ish yurituvchi | 6 | 2001 | Plastik | 238610 |

| 56 | fio25 | 1955-12-12 | Qorauzek tumani | Xamshira | 13 | 2015 | Plastik | 715830 |

| 58 | fio27 | 1954-06-06 | Qorauzek tumani | Farrosh | 25 | 2015 | Plastik | 1431660 |

| 3 | fio2 | 1951-01-01 | Beruniy tumani | Direktor | 15 | 2011 | Naqd | 1670270 |

| 5 | fio4 | 1953-01-01 | Beruniy tumani | Direktor | 15 | 2011 | Naqd | 1670270 |

| 7 | fio6 | 1955-12-12 | Beruniy tumani | Direktor | 12 | 2015 | Naqd | 1670270 |

| 16 | fio15 | 1956-08-08 | Beruniy tumani | Kompyuter operatori | 15 | 2012 | Naqd | 954440 |

| 18 | fio17 | 1953-01-01 | Beruniy tumani | Direktor | 15 | 2011 | Naqd | 1670270 |

| 20 | fio19 | 1955-12-12 | Beruniy tumani | Direktor | 12 | 2015 | Naqd | 1670270 |

| 59 | fio28 | 1955-12-05 | Beruniy tumani | Qorovul | 32 | 2000 | Naqd | 715830 |

| 60 | Eshmat | 1960-12-12 | Turtkul tumani | Doktor | 25 | 2011 | Naqd | 1431660 |

| 4 | fio3 | 1950-01-02 | Ellikqala tumani | Buxgalter | 14 | 2006 | Naqd | 954440 |

| 6 | fio5 | 1950-01-02 | Ellikqala tumani | Buxgalter | 14 | 2006 | Naqd | 954440 |

| 19 | fio18 | 1950-01-02 | Ellikqala tumani | Buxgalter | 14 | 2006 | Naqd | 954440 |

| 10 | fio9 | 1955-12-05 | Amudaryo tumani | Qorovul | 12 | 2001 | Naqd | 954440 |

| 23 | fio22 | 1955-12-05 | Amudaryo tumani | Qorovul | 12 | 2001 | Naqd | 954440 |

| 14 | fio13 | 1954-03-08 | Nukus tumani | Xamshira | 6 | 2011 | Naqd | 1670270 |

| 12 | fio11 | 1948-03-08 | Qorauzek tumani | Aloqa operatori | 24 | 2006 | Naqd | 954440 |

| 55 | fio24 | 1950-01-02 | Kegeyli tumani | Doktor | 15 | 2006 | Naqd | 1193050 |

| 13 | fio12 | 1952-03-08 | Xojayli tumani | Farrosh | 4 | 2009 | Naqd | 1670270 |

+----+--------+---------------+------------------+---------------------+-------+-------------------------+---------+---------+

30 rows in set (0.147 sec)

MariaDB [nafaqaxorlardb]> select * from umumiy

-> where tuman_nomi = 'Beruniy tumani';

-> $$

+----+-------+---------------+----------------+---------------------+-------+-------------------------+---------+---------+



| id | fio | tugilgan_sana | tuman_nomi | lav_nomi | staji | pensiya_tayinlangan_yil | turi | summa |

+----+-------+---------------+----------------+---------------------+-------+-------------------------+---------+---------+

| 1 | fio1 | 1949-12-17 | Beruniy tumani | Uqituvchi | 20 | 2009 | Plastik | 1193050 |

| 2 | fio1 | 1949-12-17 | Beruniy tumani | Uqituvchi | 20 | 2009 | Plastik | 1193050 |

| 3 | fio2 | 1951-01-01 | Beruniy tumani | Direktor | 15 | 2011 | Naqd | 1670270 |

| 5 | fio4 | 1953-01-01 | Beruniy tumani | Direktor | 15 | 2011 | Naqd | 1670270 |

| 7 | fio6 | 1955-12-12 | Beruniy tumani | Direktor | 12 | 2015 | Naqd | 1670270 |

| 16 | fio15 | 1956-08-08 | Beruniy tumani | Kompyuter operatori | 15 | 2012 | Naqd | 954440 |

| 18 | fio17 | 1953-01-01 | Beruniy tumani | Direktor | 15 | 2011 | Naqd | 1670270 |

| 20 | fio19 | 1955-12-12 | Beruniy tumani | Direktor | 12 | 2015 | Naqd | 1670270 |

| 59 | fio28 | 1955-12-05 | Beruniy tumani | Qorovul | 32 | 2000 | Naqd | 715830 |

+----+-------+---------------+----------------+---------------------+-------+-------------------------+---------+---------+

9 rows in set (0.002 sec)

MariaDB [nafaqaxorlardb]> select * from umumiy

-> where summa > 500000; $$

+----+--------+---------------+------------------+---------------------+-------+-------------------------+---------+---------+

| id | fio | tugilgan_sana | tuman_nomi | lav_nomi | staji | pensiya_tayinlangan_yil | turi | summa |

+----+--------+---------------+------------------+---------------------+-------+-------------------------+---------+---------+

| 1 | fio1 | 1949-12-17 | Beruniy tumani | Uqituvchi | 20 | 2009 | Plastik | 1193050 |

| 2 | fio1 | 1949-12-17 | Beruniy tumani | Uqituvchi | 20 | 2009 | Plastik | 1193050 |

| 9 | fio8 | 1954-06-06 | Turtkul tumani | Farrosh | 13 | 2015 | Plastik | 1431660 |

| 15 | fio14 | 1954-08-08 | Turtkul tumani | Buxgalter | 30 | 2019 | Plastik | 1431660 |

| 17 | fio16 | 1958-08-08 | Turtkul tumani | Xujalik mudiri | 13 | 2008 | Plastik | 1193050 |

| 22 | fio21 | 1954-06-06 | Turtkul tumani | Farrosh | 13 | 2015 | Plastik | 1431660 |

| 11 | fio10 | 1954-03-12 | Ellikqala tumani | Xamshira | 11 | 2002 | Plastik | 1431660 |

| 54 | fio23 | 1953-01-01 | Ellikqala tumani | Doktor | 14 | 2011 | Plastik | 954440 |

| 56 | fio25 | 1955-12-12 | Qorauzek tumani | Xamshira | 13 | 2015 | Plastik | 715830 |

| 58 | fio27 | 1954-06-06 | Qorauzek tumani | Farrosh | 25 | 2015 | Plastik | 1431660 |

| 3 | fio2 | 1951-01-01 | Beruniy tumani | Direktor | 15 | 2011 | Naqd | 1670270 |

| 5 | fio4 | 1953-01-01 | Beruniy tumani | Direktor | 15 | 2011 | Naqd | 1670270 |

| 7 | fio6 | 1955-12-12 | Beruniy tumani | Direktor | 12 | 2015 | Naqd | 1670270 |

| 16 | fio15 | 1956-08-08 | Beruniy tumani | Kompyuter operatori | 15 | 2012 | Naqd | 954440 |

| 18 | fio17 | 1953-01-01 | Beruniy tumani | Direktor | 15 | 2011 | Naqd | 1670270 |

| 20 | fio19 | 1955-12-12 | Beruniy tumani | Direktor | 12 | 2015 | Naqd | 1670270 |

| 59 | fio28 | 1955-12-05 | Beruniy tumani | Qorovul | 32 | 2000 | Naqd | 715830 |

| 60 | Eshmat | 1960-12-12 | Turtkul tumani | Doktor | 25 | 2011 | Naqd | 1431660 |

| 4 | fio3 | 1950-01-02 | Ellikqala tumani | Buxgalter | 14 | 2006 | Naqd | 954440 |

| 6 | fio5 | 1950-01-02 | Ellikqala tumani | Buxgalter | 14 | 2006 | Naqd | 954440 |

| 19 | fio18 | 1950-01-02 | Ellikqala tumani | Buxgalter | 14 | 2006 | Naqd | 954440 |

| 10 | fio9 | 1955-12-05 | Amudaryo tumani | Qorovul | 12 | 2001 | Naqd | 954440 |

| 23 | fio22 | 1955-12-05 | Amudaryo tumani | Qorovul | 12 | 2001 | Naqd | 954440 |

| 14 | fio13 | 1954-03-08 | Nukus tumani | Xamshira | 6 | 2011 | Naqd | 1670270 |

| 12 | fio11 | 1948-03-08 | Qorauzek tumani | Aloqa operatori | 24 | 2006 | Naqd | 954440 |

| 55 | fio24 | 1950-01-02 | Kegeyli tumani | Doktor | 15 | 2006 | Naqd | 1193050 |

| 13 | fio12 | 1952-03-08 | Xojayli tumani | Farrosh | 4 | 2009 | Naqd | 1670270 |

+----+--------+---------------+------------------+---------------------+-------+-------------------------+---------+---------+



27 rows in set (0.002 sec)

MariaDB [nafaqaxorlardb]>
Download 19.5 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling