Mysql> create database dedline1



Download 1,19 Mb.
Sana25.12.2022
Hajmi1,19 Mb.
#896159
Bog'liq
qIt6 4eN6HxehtZsHb1MBf7QkDiKawOU (1)



mysql> create database dedline1;
Query OK, 1 row affected (0.03 sec)

mysql> show databases;


+--------------------+
| Database |
+--------------------+
| dedline1 |
| information_schema |
| mysql |
| performance_schema |
| sakila |
| samandar |
| sver |
| sys |
| univer |
| world |
+--------------------+
10 rows in set (0.05 sec)

mysql> use dedline1;


Database changed
mysql> create table topshiriq(
-> tp1 bool,
-> tp2 int);
Query OK, 0 rows affected (0.24 sec)

mysql> show tables;


+--------------------+
| Tables_in_dedline1 |
+--------------------+
| topshiriq |
+--------------------+
1 row in set (0.25 sec)



mysql> INSERT INTO topshiriq(tp1,tp2)
-> VALUES(TRUE,1);
Query OK, 1 row affected (0.21 sec)

mysql> UPDATE topshiriq


-> SET tp2=2
-> WHERE tp1=TRUE;
Query OK, 1 row affected (0.09 sec)
Rows matched: 1 Changed: 1 Warnings: 0


mysql> DELETE FROM topshiriq WHERE tp2=2;
Query OK, 1 row affected (0.08 sec)

mysql> ALTER TABLE topshiriq add tp3 varchar(255);


Query OK, 0 rows affected (0.27 sec)
Records: 0 Duplicates: 0 Warnings: 0

mysql> ALTER TABLE topshiriq add ( tp12 varchar(255) after tp2) ;


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 'after tp2)' at line 1
mysql> ALTER TABLE topshiriq add tp12 varchar(255) first ;
Query OK, 0 rows affected (0.09 sec)
Records: 0 Duplicates: 0 Warnings: 0


mysql> ALTER TABLE topshiriq DROP COLUMN tp12;
Query OK, 0 rows affected (0.31 sec)
Records: 0 Duplicates: 0 Warnings: 0

mysql> ALTER TABLE topshiriq CHANGE tp3 tp4 int;


Query OK, 0 rows affected (0.29 sec)
Records: 0 Duplicates: 0 Warnings: 0

mysql> ALTER TABLE topshiriq MODIFY tp4 float;


Query OK, 0 rows affected (0.22 sec)
Records: 0 Duplicates: 0 Warnings: 0

mysql>



mysql> DROP TABLE topshiriq;
Query OK, 0 rows affected (0.10 sec)

mysql> DROP DATABASE dedline1;


Query OK, 0 rows affected (0.05 sec)

mysql>


2- dedline
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
select *from models where name='Orion'and id_car_model=2678;
+--------------+-------------+-------+-------------+-------------+-------------+
| id_car_model | id_car_make | name | data_create | data_update | id_car_type |
+--------------+-------------+-------+-------------+-------------+-------------+
| 2678 | 293 | Orion | 1424640262 | 1472598077 | 2 |
+--------------+-------------+-------+-------------+-------------+-------------+
1 row in set (0.05 sec)

||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||


mysql> select *from models where name='Orion'or name='Lublin 3';
+--------------+-------------+----------+-------------+-------------+-------------+
| id_car_model | id_car_make | name | data_create | data_update | id_car_type |
+--------------+-------------+----------+-------------+-------------+-------------+
| 2678 | 293 | Orion | 1424640262 | 1472598077 | 2 |
| 2679 | 294 | Lublin 3 | 1424640262 | 1472598077 | 2 |
+--------------+-------------+----------+-------------+-------------+-------------+
2 rows in set (0.00 sec)
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
mysql> select *from models where not name='Orion';
+--------------+-------------+----------+-------------+-------------+-------------+
| id_car_model | id_car_make | name | data_create | data_update | id_car_type |
+--------------+-------------+----------+-------------+-------------+-------------+
| 2677 | 292 | ATX 280E | 1424640262 | 1472598077 | 2 |
| 2679 | 294 | Lublin 3 | 1424640262 | 1472598077 | 2 |
| 2680 | 295 | 522 | 1424640262 | 1472598076 | 2 |
| 2681 | 296 | 1020 | 1424640262 | 1472598076 | 2 |
| 2682 | 297 | 1041 | 1424640262 | 1472598075 | 2 |
| 2683 | 298 | 1080 | 1424640262 | 1472598066 | 2 |
+--------------+-------------+----------+-------------+-------------+-------------+
6 rows in set (0.00 sec)
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
2
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
mysql> select *from makes where name like '%a';
+-------------+------+-------------+-------------+-------------+
| id_car_make | name | data_create | data_update | id_car_type |
+-------------+------+-------------+-------------+-------------+
| 295 | Nysa | 1424638654 | 1435173603 | 2 |
| 297 | Asia | 1424638654 | 1435173604 | 2 |
+-------------+------+-------------+-------------+-------------+
2 rows in set (0.00 sec)
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
mysql> select *from makes where id_car_make in(292,294,298);
+-------------+---------+-------------+-------------+-------------+
| id_car_make | name | data_create | data_update | id_car_type |
+-------------+---------+-------------+-------------+-------------+
| 292 | Alke | 1424638654 | 1435173602 | 2 |
| 294 | Intrall | 1424638654 | 1435173603 | 2 |
| 298 | FAW | 1424638654 | 1435173604 | 2 |
+-------------+---------+-------------+-------------+-------------+
3 rows in set (0.00 sec)
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
mysql> select *from makes where id_car_make
-> between 294 and 296 ;
+-------------+---------+-------------+-------------+-------------+
| id_car_make | name | data_create | data_update | id_car_type |
+-------------+---------+-------------+-------------+-------------+
| 294 | Intrall | 1424638654 | 1435173603 | 2 |
| 295 | Nysa | 1424638654 | 1435173603 | 2 |
| 296 | YueJin | 1424638654 | 1435173604 | 2 |
+-------------+---------+-------------+-------------+-------------+
3 rows in set (0.00 sec)
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
3
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
mysql> select *from models
-> order by name;
+--------------+-------------+----------+-------------+-------------+-------------+
| id_car_model | id_car_make | name | data_create | data_update | id_car_type |
+--------------+-------------+----------+-------------+-------------+-------------+
| 2681 | 296 | 1020 | 1424640262 | 1472598076 | 2 |
| 2682 | 297 | 1041 | 1424640262 | 1472598075 | 2 |
| 2683 | 298 | 1080 | 1424640262 | 1472598066 | 2 |
| 2680 | 295 | 522 | 1424640262 | 1472598076 | 2 |
| 2677 | 292 | ATX 280E | 1424640262 | 1472598077 | 2 |
| 2679 | 294 | Lublin 3 | 1424640262 | 1472598077 | 2 |
| 2678 | 293 | Orion | 1424640262 | 1472598077 | 2 |
+--------------+-------------+----------+-------------+-------------+-------------+
7 rows in set (0.05 sec)
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
5
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
mysql> select name from makes
-> union
-> select name from models
-> order by name;
+-----------+
| name |
+-----------+
| 1020 |
| 1041 |
| 1080 |
| 522 |
| Alke |
| Asia |
| ATX 280E |
| Doninvest |
| FAW |
| Intrall |
| Lublin 3 |
| Nysa |
| Orion |
| YueJin |
+-----------+
14 rows in set (0.08 sec)
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
mysql> select *from makes
-> where id_car_make >(select AVG(id_car_make) from makes);
+-------------+--------+-------------+-------------+-------------+
| id_car_make | name | data_create | data_update | id_car_type |
+-------------+--------+-------------+-------------+-------------+
| 296 | YueJin | 1424638654 | 1435173604 | 2 |
| 297 | Asia | 1424638654 | 1435173604 | 2 |
| 298 | FAW | 1424638654 | 1435173604 | 2 |
+-------------+--------+-------------+-------------+-------------+
3 rows in set (0.07 sec)
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
mysql> select *from makes
-> where id_car_make =(select MIN(id_car_make) from makes);
+-------------+------+-------------+-------------+-------------+
| id_car_make | name | data_create | data_update | id_car_type |
+-------------+------+-------------+-------------+-------------+
| 292 | Alke | 1424638654 | 1435173602 | 2 |
+-------------+------+-------------+-------------+-------------+
1 row in set (0.04 sec)
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

mysql> select *from makes


-> where id_car_make =(select MAX(id_car_make) from makes);
+-------------+------+-------------+-------------+-------------+
| id_car_make | name | data_create | data_update | id_car_type |
+-------------+------+-------------+-------------+-------------+
| 298 | FAW | 1424638654 | 1435173604 | 2 |
+-------------+------+-------------+-------------+-------------+
1 row in set (0.00 sec)
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
mysql> select COUNT(id_car_make)from makes;
+--------------------+
| COUNT(id_car_make) |
+--------------------+
| 7 |
+--------------------+
1 row in set (0.00 sec)
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
9
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
mysql> select models.id_car_model, makes.id_car_make
-> from models
-> inner join makes on models.id_car_model = makes.id_car_make;
Empty set (0.00 sec)
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
3- dedline
Har bir talaba o’ziga berilgan predmet soha mavzusi bo’yicha INDEX, VIEWlar yaratishi va natijasi bilan ko’rsatib o’tishi kerak.



Create table orqali yangi jadvallar hosil qilib oldik



Har bir talaba o’ziga berilgan predmet soha mavzusi bo’yicha FUNCTIONlar yaratishi va natijasi bilan ko’rsatib o’tishi kerak.










MySQL va C++ builderni bir biriga ulash uchun amalga oshiradigan ishlar:












C++ builderda MySqldagi jadvallarni ulash:









Xulosa
Bu dedlineni bajarish davomida turli olgan bilimlarimni mustaqil ravishda bir lohiyada birlashtirishga muvofaq bo’ldim deb o’ylayman. Bundan tashqari men qo’shimcha nacha ma’lumotlarga ham ega bo’ldim va ularni amalda qo’lladim. Bularga misol qilib HTML,CSS,JAVASCRTIPT ga oid lohiyaning frontent qismi uchun va lohiyaning backend qismi uchun PHP va MySql buyruqlaridan foydalandim. Ma’lumotlar bazasi fanidan olgan bilimlarimni ham anchayin kengaytirdim. Bu loyiga ish qidiruvchilarga ish beruvchilarga foydali bo’ladi deb o’ylayman.
Download 1,19 Mb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish