Relyatsion algebra AND, OR, NOT - SELECT column1, column2, ... FROM table_name WHERE condition1 AND condition2 AND condition3 ...;
- Masalan:
- SELECT * FROM Mijozlar WHERE Manzili=‘Toshkent' AND Shahri=‘Toshkent';
AND, OR, NOT - SELECT column1, column2, ... FROM table_name WHERE condition1 OR condition2 OR condition3 ...;
- Masalan:
- SELECT * FROM Mijozlar WHERE Shahri=‘Toshkent' OR Shahri=‘Farg’ona';
AND, OR, NOT - SELECT column1, column2, ... FROM table_name WHERE NOT condition;
- Masalan:
- SELECT * FROM Mijozlar WHERE NOT Shahri=‘Toshkent'
DBMS, SQL, IN - SELECT column_name(s) FROM table_name WHERE column_name IN (value1, value2, ...);
- Masalan:
- SELECT * FROM Mijozlar WHERE Manzili IN (‘Yunusobod', ‘Chilonzor', ‘Olma-zor');
ORDER BY - SELECT column1, column2, ... FROM table_name ORDER BY column1, column2, ... ASC|DESC;
- Masalan:
- SELECT * FROM Mijozlar
- ORDER BY Shahri;
- SELECT * FROM Mijozlar
- ORDER BY Yoshi ASC|DESC;
LIKE operatori - SELECT column1, column2, ... FROM table_name WHERE columnN LIKE Condition;
- Masalan:
- SELECT * FROM Customers
- WHERE CustomerName LIKE 'a%';
LIKE operatori - WHERE CustomerName LIKE 'a%'
| - CustomerName atributidan "a“ harfi bilan boshlanadiganini chiqaradi
| - WHERE CustomerName LIKE '%a'
| - CustomerName atributidan "a“ harfi bilan tugaydiganini chiqaradi
| - WHERE CustomerName LIKE '%or%'
| - CustomerName atributidan tarkibida “or” mavjudlarini chiqaradi
| - WHERE CustomerName LIKE '_r%'
| - CustomerName atributidan ikkinchi harfi “r”bilan boshlanadiganini chiqaradi
| - WHERE ContactName LIKE 'a%o'
| - CustomerName atributidan "a“ harfi bilan boshlanadigan va “o” bilan tugaydiganini chiqaradi
| BETWEEN operatori - SELECT column1, column2, ... FROM table_name WHERE columnN LIKE Condition;
- Masalan:
- SELECT * FROM Products
- WHERE Price BETWEEN 10 AND 20;
Relatsiyon algebra va ularning amallari. - Relatsiyon algebra va ularning amallari.
Relyatsion algebra va uning amallari. - Relyatsion algebrada 4ta amal ishlatiladi:
Birlashtirish Birlashtirish (Union) Kesishma/Birlashtirish/Ayirma Dekart Ko’paytma Jadval ma’lumotlarini Birlashtirish amali - SELECT * FROM `Mijoz 1`
- UNION
- SELECT * FROM `Mijoz 2`;
- SELECT * FROM `Mijoz 1`
- MINUS/EXEPT
- SELECT * FROM `Mijoz 2`;
- SELECT * FROM `Mijoz 1`
- INTERSECT/JOIN
- SELECT * FROM `Mijoz 2`;
- SELECT Familiyasi FROM Jadval1 UNION ALL SELECT Fan, Sana FROM jadval2 ORDER BY Familiyasi;
Relyatsion algebra va uning amallari. Maxsus amallar : - Maxsus amallar :
- Tanlash (seleksiya)
- Proeksiya
- Qo‘shish
- Bo‘lish
- Munosabatlar ustida bajariladigan birlashtirish, kesishuv, ayiruv amallari operatorlarning tili yoki turi bo‘yicha mosligini talab etadi. 2 ta munosabat tipi bo‘yicha mos keladi, agarda ularda ekvivalent munosabat sxemasi bo‘lib:
- Ulardagi har bir darajasi bir xil bo‘lsa yoki ular bir xil atribut to‘plamiga ega bo‘lsa;
- sxema atributlarini shunday tartiblash mumkinki, bir xil o‘rinda turib solishtirilayotgan atributlari bir xil domenda aniqlangan bo‘lishi kerak.
Dekart Ko’paytmasida matematik munosabatlar darajasi operant munosabat darajalarining yig‘indisiga teng. Kuvvati esa operant kuvvatlarini ko‘paytmasiga teng. - Dekart Ko’paytmasida matematik munosabatlar darajasi operant munosabat darajalarining yig‘indisiga teng. Kuvvati esa operant kuvvatlarini ko‘paytmasiga teng.
- Seleksiya (tanlash) amali 1 ta munosabat ustida bajariladi. Natija munosabatda biror shart bo‘yicha tanlab olingan kartejlar katnashadi.
- Qo‘shish amali 2 ta operant ustida bajariladi. Xar bir munosabat qaysi atribut bo‘yicha qo‘shish bajarilayotgan bo‘lsa, u ajratiladi.
- Natija munosabat 1 va 2-munosabatni barcha atributlarini o‘z ichiga oladi.
- Relyatsion MB munosabatlarida strukturali va semantik axborotlar saqlanishi mumkin. Strukturaviy axborotlarni biz munosabat sxemalar yordamida bilamiz.
- Semantik axborotlar esa munosabat sxemalarda ma’lum bulgan va xisobga olinadigan va atributlar o‘rtasidagi funksional bog‘lanishlar bilan ifodalanadi. MBdagi munosabatlarda atributlarni tarkibi 2 ta talabga javob berishi kerak
Реляцион ҳисоблаш - Ma’lumot modelini rivojlanish konsepsiyasi 5 ta bosqichni ko‘rsatishi mumkin:
- 60- yillarning 2 – yarmida, bunda asosan ierarxik modellarga e’tibor berilgan;
- 70- yillarni 1 – yarmi, tarmoqli modellar;
- 70- yillarning 2 – yarmi, relyatsion modellar;
- 80- yillarning 1 – yarmi, semantik modellar;
- 80- yillarning 2 – yarmi, ob’ektga mo‘ljallangan sistema.
- 90-20xx – Strukturalangan va strukturalanmagan MB
Mashqlar - Mahsulot jadvalini yarating (id_mahsulot, mahsulot_nomi, narxi, ishlab_chiqaruvchi, hajmi), (4 ta yozuv qo’shilsin). SELECT orqali narxi 10000 so’m va 100000 so’m oralig`idagilarni va “a” harfi bilan boshlanuvchi mahsulotlari chiqaring.
- Xodim jadvalini yarating (id_xodim, FISh, lavozimi, maoshi, tel_raqami, manzili). (4 ta yozuv qo’shilsin). SELECT orqali maoshi 500000 so’m va 1300000 so’m oralig`idagilarni va “a” harfi bilan tugovchi xodimlarni chiqaring.
- Nazorat savollari.
- Relyatsion ma’lumotlar bazasini asosiy tushunchalari.
- Munosabat xossalari.
- Munosabatlar sxemasi.
- Relyatsion algebra amallari
-
Do'stlaringiz bilan baham: |