RAQAMLI TEXNOLOGIYALAR VAZIRLIGI
MUHAMMAD AL – XORAZMIY NOMIDAGI
TOSHKENT AXBOROT TEXNOLOGIYALARI
UNIVERSITETI
FARG‘ONA FILIALI
Komyuter injiniringi yo‘nalishi
711-21– guruh talabasi
Muhammadiyev Umidjon ning
“Ma’lumotlar bazasi”
fanidan tayyorlagan
Mustaqil ish
Topshirdi: Muhammadiyev Umidjon
Qabul qildi: Umurzakova D. M.
12. Qo'shimcha mas'uliyatni taqsimlash
Jadvallar
Xodimlar (xodimning kodi, familiyasi, ismi, otasining ismi, ish haqi).
Ish turlari (Tur kodi, Tavsif, kuniga to'lov).
Ish (xodim kodi, tur kodi, boshlanish sanasi, tugash sanasi).
Muammo bayonini ishlab chiqish
Koidi
Enter password: ********
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.34 MySQL Community Server - GPL
Copyright (c) 2000, 2023, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+---------------------------------+
| Database |
+---------------------------------+
| 711kif |
| employee |
| information_schema |
| malumotlar |
| mysql |
| performance_schema |
| qushimcha_masulyatni_taqsimlash |
| sys |
+---------------------------------+
8 rows in set (0.03 sec)
mysql> create database qoshimcham;
Query OK, 1 row affected (0.01 sec)
mysql> use qoshimcham;
Database changed
mysql> create table ish (int id auto_increment primary key,
-> create table ish (int id auto_increment primary key,,;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'int id auto_increment primary key,
create table ish (int id auto_increment prima' at line 1
mysql> create table ish (id int(3) auto_increment primary key,
-> xodimKodi int(3) not null,
-> turKodi int(3) not null,
-> boshSana date not null,
-> tugSana date not null);
Query OK, 0 rows affected, 3 warnings (0.01 sec)
mysql> create table ishTuri (id int auto_increment primary key,
-> tavsif varchar(255),
-> kunigaTolov float(10.2) not null,
-> );
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 4
mysql> create table ishTuri (id int auto_increment primary key,
-> tavsif varchar(255),
-> kunigaTolov float(10.2) not null);
Query OK, 0 rows affected (0.01 sec)
mysql> create table xodimlar( id int(3) auto_increment primary key,
-> familyasi varchar(30) not null,
-> ismi varchar(12) not null,
-> otasiIsmi varhcar(12) not null,
-> ishHaqqi float(10.2) not null);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'varhcar(12) not null,
ishHaqqi float(10.2) not null)' at line 4
mysql> create table xodimlar( id int(3) auto_increment primary key,
-> familyasi varchar(30) not null,
-> ismi varchar(12) not null,
-> otasiIsmi varchar(12) not null,
-> ishHaqqi float(10.2) not null);
Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql> alter table ish add foreign key(xodimKodi) references xodimlar(id);
Query OK, 0 rows affected (0.04 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> alter table ish add foreign key(turKodi) references ishturi(id);
Query OK, 0 rows affected (0.03 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> alter table xodimlar values
-> (
-> null, 'Safarov', 'Shahzod', 'Siroj og`li', 2000000
-> );
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'values
(
null, 'Safarov', 'Shahzod', 'Siroj og`li', 2000000
)' at line 1
mysql> insert into xodimlar (
-> null, 'Safarov', 'Shahzod', 'Siroj og`li', 2000000
-> );
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'null, 'Safarov', 'Shahzod', 'Siroj og`li', 2000000
)' at line 2
mysql> insert into xodimlar values
-> (null, 'Safarov', 'Shahzod', 'Siroj o`g`li', 2000000);
Query OK, 1 row affected (0.01 sec)
mysql> insert into xodimlar values
-> (null, 'Holyarov', 'Abdumannon', 'Muhammad o`g`li', 6000000);
ERROR 1406 (22001): Data too long for column 'otasiIsmi' at row 1
mysql> insert into xodimlar values
-> (null, 'Holyarov', 'Abdumannon', 'Muhammad', 6000000);
Query OK, 1 row affected (0.00 sec)
mysql> insert into xodimlar values
-> (null, 'Holyarov', 'Sabo', 'Muhammad', 350000);
Query OK, 1 row affected (0.00 sec)
mysql> insert into xodimlar values
-> (null, 'Pirmatov', 'Kamol', 'Safar', 750000);
Query OK, 1 row affected (0.00 sec)
mysql> insert into xodimlar values
-> (null, 'Pirmatov', 'Siroj', 'Safar', 4000000);
Query OK, 1 row affected (0.00 sec)
mysql> insert into xodimlar values
-> (null, 'Pirmatova', 'Guli', 'Humoyun', 3000000);
Query OK, 1 row affected (0.00 sec)
mysql> insert into ishturi values
-> (null, 'O`qituvchi', 66000);
Query OK, 1 row affected (0.00 sec)
mysql> insert into ishturi values
-> (null, 'Boshqaruvchi', 112000);
Query OK, 1 row affected (0.00 sec)
mysql> insert into ishturi values
-> (null, 'Direktor', 133000);
Query OK, 1 row affected (0.00 sec)
mysql> insert into ishturi values
-> (null, 'Moliyachi', 250000);
Query OK, 1 row affected (0.00 sec)
mysql> insert into ishturi values
-> (null, 'Hamshira', 100000);
Query OK, 1 row affected (0.00 sec)
mysql> select * from ishturi;
+----+--------------+-------------+
| id | tavsif | kunigaTolov |
+----+--------------+-------------+
| 1 | O`qituvchi | 66000 |
| 2 | Boshqaruvchi | 112000 |
| 3 | Direktor | 133000 |
| 4 | Moliyachi | 250000 |
| 5 | Hamshira | 100000 |
+----+--------------+-------------+
5 rows in set (0.00 sec)
mysql> select * from xodimlar;
+----+-----------+------------+--------------+----------+
| id | familyasi | ismi | otasiIsmi | ishHaqqi |
+----+-----------+------------+--------------+----------+
| 1 | Safarov | Shahzod | Siroj o`g`li | 2000000 |
| 2 | Holyarov | Abdumannon | Muhammad | 6000000 |
| 3 | Holyarov | Sabo | Muhammad | 350000 |
| 4 | Pirmatov | Kamol | Safar | 750000 |
| 5 | Pirmatov | Siroj | Safar | 4000000 |
| 6 | Pirmatova | Guli | Humoyun | 3000000 |
+----+-----------+------------+--------------+----------+
6 rows in set (0.00 sec)
mysql> desc ish;
+-----------+------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------+------+------+-----+---------+----------------+
| id | int | NO | PRI | NULL | auto_increment |
| xodimKodi | int | NO | MUL | NULL | |
| turKodi | int | NO | MUL | NULL | |
| boshSana | date | NO | | NULL | |
| tugSana | date | NO | | NULL | |
+-----------+------+------+-----+---------+----------------+
5 rows in set (0.00 sec)
mysql> insert into ish values
-> (null,1,1, '2022-01-10', '2024-03-30');
Query OK, 1 row affected (0.00 sec)
mysql> insert into ish values
-> (null,2,2, '2015-03-15', '2029-04-30');
Query OK, 1 row affected (0.00 sec)
mysql> insert into ish values
-> (null,3,1, '2018-09-5', '2034-05-30');
Query OK, 1 row affected (0.00 sec)
mysql> insert into ish values
-> (null,4,4, '2004-01-01', '2030-11-27');
Query OK, 1 row affected (0.00 sec)
mysql> (null,5,3, '2020-09-01', '2028-05-30');
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'null,5,3, '2020-09-01', '2028-05-30')' at line 1
mysql> insert into ish values
-> (null,5,3, '2020-09-1', '2028-05-30');
Query OK, 1 row affected (0.00 sec)
mysql> insert into ish values
-> (null,6,5, '2022-01-1', '2025-12-30');
Query OK, 1 row affected (0.00 sec)
mysql> select * from ish;
+----+-----------+---------+------------+------------+
| id | xodimKodi | turKodi | boshSana | tugSana |
+----+-----------+---------+------------+------------+
| 1 | 1 | 1 | 2022-01-10 | 2024-03-30 |
| 2 | 2 | 2 | 2015-03-15 | 2029-04-30 |
| 3 | 3 | 1 | 2018-09-05 | 2034-05-30 |
| 4 | 4 | 4 | 2004-01-01 | 2030-11-27 |
| 5 | 5 | 3 | 2020-09-01 | 2028-05-30 |
| 6 | 6 | 5 | 2022-01-01 | 2025-12-30 |
+----+-----------+---------+------------+------------+
6 rows in set (0.00 sec)
|