mysql> select * from hodimlar
-> group by ish_bolimi
-> having ish_bolimi=1;
mysql> select * from hodimlar
-> order by ish_bolimi asc,
familiyasi desc;
mysql> select * from hodimlar
-> order by ish_bolimi desc,
familiyasi asc;
Index va view
mysql> create index in_hodimlar
-> on hodimlar(ismi, familiyasi);
Query OK, 9 rows affected (0.20 sec)
Records: 9 Duplicates: 0 Warnings: 0
mysql> show indexes from hodimlar;
mysql>
create view maoshlar
-> as select H_id,ismi,familiyasi,ish_bolimi,lavozimi,oyligi from hodimlar
-> order by oyligi desc limit 9;
Query OK, 0 rows affected (0.09 sec)
mysql> select *
from maoshlar;
Join
mysql> select h_id,nomi,yetkazuvchi_id from homashyo
-> union all
-> select yet_id,nomi,xodim from yetkazuvchilar;
mysql> select*from yetkazuvchilar cross join homashyo limit 5;
mysql> select*from yetkazuvchilar
inner join homashyo on
yetkazuvchilar.yet_id=homashyo.yetkazuvchi_id;
Alter buyrug’i
mysql> alter table bolimlar
-> modify bolim_rahbari int(7) not null;
Query OK, 0 rows affected (0.15 sec)
mysql>
alter table hodimlar
-> modify ish_bolimi int(7) not null;
Query OK, 1 row affected (0.19 sec)
Records: 1 Duplicates: 0 Warnings: 0
mysql> alter table yetkazuvchilar
-> modify Homashyo_nomi int(7) not null;
Query OK, 1 row affected (0.17 sec)
Records: 1 Duplicates: 0 Warnings: 0\
mysql>
alter table homashyo
-> drop column manzili;
Query OK, 5 rows affected (0.22 sec)
Records: 5 Duplicates: 0 Warnings: 0
Saytga bog’lash va Webb sahifa ko’rinishidagi holat.