Standart funksyalardan foydalanib so’rovlar yaratish.
mysql>
select shahar from kutubxona;
+----------+
| shahar |
+----------+
| Fergana |
| Fergana |
| Fergana |
| Fergana |
| Fergana |
| Toshkent |
| Toshkent |
+----------+
7 rows in set (0.04 sec)
mysql> select concat(nomi,manzil,shahar) from kutubxona;
+---------------------------------------+
| concat(nomi,manzil,shahar) |
+---------------------------------------+
| TATU 1-ARMA_Navoiykocha 2-uyFergana |
| TATU 2-ARMQodiriykocha 2-uyFergana |
| TATU 3-ARMYaxshilikkocha 2-uyFergana |
| TATU 4-ARMA_Navoiykocha 2-uyFergana |
| TATU 5-ARMA_Navoiykocha 3-uyFergana |
| TATU 1-ARMBeruniykocha 1-uyToshkent |
| TATU 2-ARMBeruniykocha 1-uyToshkent |
+---------------------------------------+
7 rows in set (0.04 sec)
mysql> select bin(12);
+---------+
| bin(12) |
+---------+
| 1100 |
+---------+
1 row in set (0.06 sec)
mysql> select oct(12);
+---------+
| oct(12) |
+---------+
| 14 |
+---------+
1 row in set (0.00 sec)
mysql>
create database agregat;
Query OK, 1 row affected (0.24 sec)
mysql>
use agregat;
Database
changed
mysql>
create table mevalar
->( id_m int(7) auto_increment primary key,
->Hol_mevalarvarchar(25)
not null,
->Quruq_mevalarvarchar(25) not null,
->poliz_ekinlarivarchar(25) not null,
->narxlarivarchar(25) not null ) ;
Query OK, 0 rows affected (0.45 sec)
mysql>
desc mevalar;
+----------------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------+-------------+------+-----+---------+----------------+
| id_m | int(7) | NO | PRI | NULL | auto_increment |
| Hol_mevalar | varchar(25) | NO | | NULL | |
| Quruq_mevalar | varchar(25) | NO | | NULL | |
| poliz_ekinlari | varchar(25) | NO | | NULL | |
| narxlari | varchar(25) | NO | | NULL | |
+----------------+-------------+------+-----+---------+----------------+
5 rows in set (0.08 sec)
mysql> select avg(ishga_kirgan_yili)
from xodimlar
-> where ishga_kirgan_yili='2021';
+------------------------+
| avg(ishga_kirgan_yili) |
+------------------------+
| 2021 |
+------------------------+
1 row in set (0.00 sec)