mysql> show databases;
Database
712 22 guruh
information schema
mysql performance
schema
6 rows in set (8.82 sec)
mysql> drop database guruh; Query OK,
2 rows affected (8.84 sec) mysql> show
databases;
Database
712 22 information
schema mysql
performance
schema
rq:n.as in set (8.8B sec)
mysql> create database guruh; Query
OK, 1 row affected (8.81 sec)
Database changed mysql> create table mysql> desc talaba; Field Type Null Key
Talaba(id int, fio Query OK, rows affected
(B.øs sec) mysql> desc talaba; Field Type Null id int fio varchar(2SS) YES manzil
I Key I varchar(2SS) YES passport I varchar(g)
id int fio varchar(2SS) tyutor_id I int NO
YES manzil varchar(2SS) rows in set (B.øø sec)
YES passport I varchar(g) varchar(2SS), manzil varchar(g));
4 rows in set (8.82 sec)
mysql> alter table t alaba add
tyutor_id Query OK, rows affected
(8.84 sec) Records : Duplicates:
Warnings :
Default I Extra I NULL
NULL
NULL
NULL NULL
NULL
NULL
int not null;
Default I Extra I
NULL
NULL
mysql> insert Into talaba (16, +10, manzll, passport, tyutor 1
- > values (1, Dehqonova Durdonaxon' Farg’ona' , 'AD1964545', 1) Query OK, 1
row affected (B. B2 sec) mysql> select from talaba;
I id I fio manzil I passport I tyutor_id I
1 | Xudoynazarova Nazokatxon I Namangan I AA987S462 1 Il
1 row in set (ø.øø sec)
mysql> insert into t alaba (id, fio, manzil, passport, tyutor_id)
values (2, maxmudova Rayxonoy• , Fargona , • AD4S69871' ,2);
Query OK, 1 row affected (B. BI sec)
mysql> > insert into talaba (id, fio, manzil, passport, tyutor_id)
-> values(3, Axunova Diyora% toshkent , AD4S67431 ,2);
ERROR 1864 (4288B) : You have an error in your SQL syntax; check the
manual that o talaba (id, fio, manzil, passport, tyutor_id) values(3, Axunov•
at line 1 mysql> insert into talaba Cid, fio, manzil, passport, tyutor_id)
-> values(3, Axunova Diyora% toshkent ,
Query OK, 1 row affected (B. B2 sec)
mysql> insert into talaba (id, fio, manzil, passport, tyutor_id)
values (4, Erkaboyev Shaxboz , • fargona% Query OK, 1 row
affected (B. B2 sec)
mysql> insert into talaba (id, fio, manzil, passport, tyutor_id)
> values(S, •mamadolimova Durdona• , Oltiariq ' , 'AB-3269871',1) •,
ERROR 1864 (4288B) : You have an error in your SQL syntax; check the manual that
mamadolimova Durdona , Oltiariq ' , at line 2 my sq 1> insert into talaba (id, fio, manzil, passport,
tyutor id) values (S, mamadolimova Durdona• , Oltiariq ' , 'AB3269871' ,1); Query OK, 1 row
affected (B. B2 sec)
mysql> insert into talaba (id, fio, manzil, passport, tyutor_id) values (6,
Bozorova Xadiya , Oltiariq '
mysql> select from talaba;
id fio manzil fio varchar(2SS) YES
Xudoynazarova Nazokatxon Namangan telefon I int
maxmudova Rayxonoy F argon a passport tyutor_id
Axunova Diyora toshkent Erkaboyev
AA987S462 1
Shaxboz fargona mamadolimova
AD4S69871 21
Durdona Oltiariq Bozorova Xadiya
AD4S67431
Oltiariq
ADS399921
6 rows in set (8.0B sec) AB3269871
ADS378621 21
mysql> create table tyutor(id int primary key,
Query OK, B rows affected (8.84 sec) mysql>
desc tyutor; fio varchar(2SS), telefon int
Field Type Null Key Default
id int NO PRI NULL
I Extra I
3 rows in set (8.81 sec)
mysql> insert i nto tyutor values (1, 'Xudoynazarova Nazokatxon•,
912365478),
- > values (2, Rizayeva Namuna• , 936574312);
ERROR 1864 (42808) : You have an error in your SQL syntax; check the manual th zayeva
Namuna 936574312) ' at line 3 mysql> insert i nto tyutor
- > values(l, Xudoynazarova Nazokatxon•, 912365478); Query OK, 1
row affected (8.82 sec)
mysql> insert i nto tyutor values (2, Rizayeva
Namuna , 936574312);
Query OK, 1 row affected (8.82 sec)
mysql select from tyutor;
I id I flo telefon
Dehqonova DurdonaxonI AD1964545|
Rizayeva Namuna 936574312 |
2 rows in set (8.08 sec)
mysql> alter table talaba add foreign key(tyutor_id) references tyutor(id);
Query OK, 6 rows affected (8. IS sec) Records : 6 Duplicates: 8 Warnings :
mysql> select from t alaba
id I fio manzil passport I tyutor_id I
Namangan AA987S462 1 Il
1 | Xudoynazarova Nazokatxon
1 row in set (8.08 sec)
mysql> select from talaba
where fio like ;
id fio manzil passport I tyutor_id I
Xudoynazarova Nazokatxon Namangan AA987S462 1 Il
maxmudova Rayxonoy F argon a AD4S69871 21
Axunova Diyora toshkent AD4S67431 21
mamadolimova Durdona Oltiariq AB3269871 Il
Bozorova Xadiya Oltiariq ADS378621 1 21
- > where manzil= Namangan '
rows in set (8.08 sec)
mysql> select From talaba where
manziI='Fargona '
id fio manzil passport I tyutor_ld I
I maxmudova Rayxonoy F a rgona 21
I Erkaboypv Shaxb07 + a rgona Los;qg021 1
2 rows in set (e. BB sec)
mysql> select From talaba
join tyutor• on
talaba.
flo passport tyutor t plpfon
Xucioynazanova Nazckatxon Namangan AAgg7S4€2 Xudoynazan•va Nazokatxon 01236;17e Erkaboyev Shaxboz Fargo n a
AD;399C21 Xudoynazarcva Nazokatxon 91236;47e
Yamadolinova Durdona Oltiariq *433269871 Xudovnazarova Nazokatxon 91236547B I 2 maxmudova Rayxora3y F argon a AD4559871
Rizayeva Namuna 936574312 Axunova Divora toshkent AD4557431 1 Rizayeva Namuna 936574312 |
8czorq)va xadlya Oltlarlq AD5378621 1 Rlzayeva Nanuna 936574312
In set (ø_B2 sec)