Muhammad-Al Xorazmiy nomidagi
Toshkent axbarot texnologiyalar universitetining
“Telekomunikatsiya texnologiyalari” fakultetining
414-21-guruh talabasi Choriyev Fazliddinning Malumotlar bazasi fanidan bajargan
2-shaxsiy topshirig’i
Enter password: ******
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.28 MySQL Community Server - GPL
Copyright (c) 2000, 2022, 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 |
+--------------------+
| hokimyat |
| gun |
| information_schema |
| internet_magazin |
| man |
| mustaqil |
| mysql |
| oquv |
| oquvci |
| performance_schema |
| student |
| sys |
| vakzal |
+--------------------+
13 rows in set (0.09 sec)
mysql> use center;
Database changed
mysql> select*from center;
ERROR 1146 (42S02): Table 'center.center' doesn't exist
mysql> create database hokimyat;
Query OK, 1 row affected (0.23 sec)
mysql> use hokimyat;
Database changed
mysql> create table hokim(id int, ismi varchar(20), lavozimi varchar(20));
Query OK, 0 rows affected (0.87 sec)
mysql> insert into xurmat values(1,"FAZLIDDIN","HOKIM"),(2,"AZIZBEK","HOKIMYORDAMCHISI"),(3,"MURODJON","ORINBOSAR");
Query OK, 3 rows affected (0.20 sec)
Records: 3 Duplicates: 0 Warnings: 0
mysql> SELECT*from hokim;
+------+-----------+-------------------+
| id | ismi | lavozimi |
+------+-----------+-------------------+
| 1 | FAZLIDDIN | HOKIM |
| 2 | AZIZBEK | HOKIMYORDAMCHISI |
| 3 | MURODJON | ORINBOSAR |
+------+-----------+-------------------+
3 rows in set (0.00 sec)
mysql> alter table hokim add oyligi date;
Query OK, 0 rows affected (0.41 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> update hokim set oyligi=10000000 where id=1;
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 '.2022 where id=1' at line 1
mysql> update hokim set oyligi="10000000" where id=1;
Query OK, 1 row affected, 1 warning (0.42 sec)
Rows matched: 1 Changed: 1 Warnings: 1
mysql> select*from hokim;
+------+-----------+-------------------+------------+
| id | ismi | lavozimi | oyligi |
+------+-----------+-------------------+------------+
| 1 | FAZLIDDIN | HOKIM | 10000000 |
| 2 | AZIZBEK | HOKIMYORDAMCHISI | NULL |
| 3 | MURODJON | ORINBOSAR | NULL |
+------+-----------+-------------------+------------+
3 rows in set (0.00 sec)
mysql> update hokim set oyligi=5000000 where id=2;
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 '.2022 where id=2' at line 1
mysql> mysql> update hokim set oyligi="5000000" where id=2;
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 'mysql> update xurmat set sana="20.11.2022" where id=2' at line 1
mysql> mysql> update hokim set oyligi="5000000 " where id=2;
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 'mysql> update hokim set oyligi="5000000" where id=2' at line 1
mysql> update hokim set oyligi="7000000" where id=3;
Query OK, 1 row affected, 1 warning (0.17 sec)
Rows matched: 1 Changed: 1 Warnings: 1
mysql> update hokim set oyligi="5000000" where id=2;
Query OK, 1 row affected, 1 warning (0.18 sec)
Rows matched: 1 Changed: 1 Warnings: 1
mysql> swlwct * from hokim;
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 'swlwct * from xurmat' at line 1
mysql> select * from hokim;
+------+-----------+-------------------+------------+
| id | ismi | lavozimi | oyligi |
+------+-----------+-------------------+------------+
| 1 | FAZLIDDIN | HOKIM | 10000000 |
| 2 | AZIZBEK | HOKIMYORDAMCHISI | 5000000 |
| 3 | MURODJON | ORINBOSAR | 7000000 |
+------+-----------+-------------------+------------+
3 rows in set (0.00 sec)
mysql> select id, ismi from hokim where id>1;
+------+----------+
| id | ismi |
+------+----------+
| 2 | AZIZBEK |
| 3 | MURODJON |
+------+----------+
2 rows in set (0.00 sec)
mysql> select *from hokim;
+------+-----------+-------------------+------------+
| id | ismi | lavozimi | oyligi |
+------+-----------+-------------------+------------+
| 1 | FAZLIDDIN | HOKIM | 10000000 |
| 2 | AZIZBEK | HOKIMYORDAMCHISI | 5000000 |
| 3 | MURODJON | ORINBOSAR | 7000000 |
+------+-----------+-------------------+------------+
3 rows in set (0.00 sec)
mysql> delete from hokim where id=2;
Query OK, 1 row affected (0.21 sec)
mysql> select * from hokim;
+------+-----------+-------------------+------------+
| id | ismi | lavozimi | oyligi |
+------+-----------+-------------------+------------+
| 1 | FAZLIDDIN | HOKIM | 10000000 |
| 3 | MURODJON | ORINBOSAR | 7000000 |
+------+-----------+-------------------+------------+
2 rows in set (0.00 sec)
mysql> Select *from hokim where id between 2 and 4;
+------+----------+-----------+------------+
| id | ismi | lavozimi | oyligi |
+------+----------+-----------+------------+
| 3 | MURODJON | ORINBOSAR | 7000000 |
+------+----------+-----------+------------+
1 row in set (0.00 sec)
Enter password: ******
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.28 MySQL Community Server - GPL
Copyright (c) 2000, 2022, 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 |
+--------------------+
| hokimyat |
| gun |
| information_schema |
| internet_magazin |
| man |
| mustaqil |
| mysql |
| oquv |
| oquvci |
| performance_schema |
| student |
| sys |
| vakzal |
+--------------------+
14 rows in set (0.38 sec)
mysql> use mustaqil;
Database changed
mysql> select * from xurmat;
ERROR 1146 (42S02): Table 'mustaqil.xurmat' doesn't exist
mysql> insert imto xurmat values(4,"Xusanjon","matematik");
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 'xurmat values(4,"Xusanjon","matematik")' at line 1
mysql> sshow databases;
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 'sshow databases' at line 1
mysql> select*from xurmat;
ERROR 1146 (42S02): Table 'mustaqil.xurmat' doesn't exist
mysql> use hokimyat;
Database changed
mysql> select* from hokim;
+------+-----------+-------------------+------------+
| id | ismi | lavozimi | oyligi |
+------+-----------+-------------------+------------+
| 1 | FAZLIDDIN | HOKIM | 10000000 |
| 3 | MURODJON | ORINBOSAR | 7000000 |
+------+-----------+-------------------+------------+
2 rows in set (0.19 sec)
mysql> select*from hokim;
+------+-----------+-------------------+------------+
| id | ismi | lavozimi | oyligi |
+------+-----------+-------------------+------------+
| 1 | FAZLIDDIN | HOKIM | 10000000 |
| 3 | MURODJON | ORINBOSAR | 7000000 |
+------+-----------+-------------------+------------+
2 rows in set (0.00 sec)
mysql> select max(id) as oyligi;
ERROR 1054 (42S22): Unknown column 'id' in 'field list'
mysql> select max(id) 'oyligi' from hokim;
+------+
| oyligi |
+------+
| 1 |
+------+
1 row in set (0.02 sec)
mysql> select sum(id) 'ismi' from hokim;
+------+
| ismi |
+------+
| 4 |
+------+
1 row in set (0.00 sec)
mysql> select mid(ismi,1,1) as lavozimi ismi from hokim;
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 'ismi from hokim' at line 1
mysql> select mid(ismi ,1,1) as ' lavozimi ', ismi from hokim;
+------------+-----------+
| lavozimi | ismi |
+------------+-----------+
| F | FAZLIDDIN |
| M | MURODJON |
+------------+-----------+
2 rows in set, 1 warning (0.00 sec)
mysql> alter table hokim add ish_tajribasi int ;
Query OK, 0 rows affected (0.68 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> select* from hokim;
+------+-----------+-------------------+------------+-------------+
| id | ismi | lavozimi | oyligi | ish_tajribasi |
+------+-----------+-------------------+------------+-------------+
| 1 | FAZLIDDIN | HOKIM | 10000000 | NULL |
| 3 | MURODJON | ORINBOSAR | 7000000 | NULL |
+------+-----------+-------------------+------------+-------------+
2 rows in set (0.00 sec)
mysql> update hokim set ish_tajribasi=8 where id=1;
Query OK, 1 row affected (0.19 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> update hokim set ish_tajribasi=5 where id =2;
Query OK, 0 rows affected (0.00 sec)
Rows matched: 0 Changed: 0 Warnings: 0
mysql> update hokim set ish_tajribasi=7 where id=3;
Query OK, 1 row affected (0.17 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select *from hokim;
+------+-----------+-------------------+------------+-------------+
| id | ismi | lavozimi | oyligi | ish_tajribasi |
+------+-----------+-------------------+------------+-------------+
| 1 | FAZLIDDIN | HOKIM | 10000000 | 8 |
| 3 | MURODJON | ORINBOSAR | 7000000| 7 |
+------+-----------+-------------------+------------+-------------+
2 rows in set (0.00 sec)
mysql> select id ,sum(ish_tajribasi) as' ish_tajribasi' from hokim group by id;
+------+-------------+
| id | |
+------+-------------+
| 1 | 8 |
| 3 | 7 |
+------+-------------+
2 rows in set, 1 warning (0.04 sec)
mysql> select * from hokim order by lavozimi;
+------+-----------+-------------------+------------+-------------+
| id | ismi | lavozimi | oyligi | ish_tajribasi |
+------+-----------+-------------------+------------+-------------+
| 1 | FAZLIDDIN | HOKIM | 10000000 | 8 |
| 3 | MURODJON | ORINBOSAR | 7000000 | 7 |
+------+-----------+-------------------+------------+-------------+
2 rows in set (0.10 sec)
mysql> select * from hokim having ish_tajribasi >7;
+------+----------+-----------+------------+-------------+
| id | ismi | lavozimi | oyligi | ish_tajribasi |
+------+----------+-----------+------------+-------------+
| 1 | FAZLIDDIN | HOKIM | 10000000 | 8 |
+------+----------+-----------+------------+-------------+
1 row in set (0.14 sec)
mysql> select *from hokim ;
+------+-----------+-------------------+------------+-------------+
| id | ismi | lavozimi | oyligi | ish_tajribasi |
+------+-----------+-------------------+------------+-------------+
| 1 | FAZLIDDIN | HOKIM | 10000000 | 8 |
| 3 | MURODJON | ORINBOSAR | 7000000 | 7 |
+------+-----------+-------------------+------------+-------------+
2 rows in set (0.00 sec)
mysql>
Do'stlaringiz bilan baham: |