|
Texnologiyalari va
|
Sana | 19.05.2024 | Hajmi | 304,43 Kb. | | #243428 |
Bog'liq N2
O‘ZBEKISTON RESPUBLIKASI AXBOROT
TEXNOLOGIYALARI VA
KOMMUNIKATSIYALARINI RIVOJLANTIRISH VAZIRLIGI
MUHAMMAD AL-XORAZMIY NOMIDAGI
TOSHKENT AXBOROT TEXNOLOGIYALARI UNIVERSITETI
MALUMOTLAR BAZASI
Guruh: 214-22
Bajardi: Ashuraliyev N
Tekshirdi: Iroda Uralova
11 – Amaliy mashg’ulot
Mavzu: Murakkab so‘rovlar yaratish. TOP, LIMIT yoki ROWNUM
Ishdan maqsad: Berilgan predmet soha ma`lumotlar bazasidan foydalanib TOP, LIMIT yoki ROWNUM lardan foydalanishni o`rganish.
Masalani qo`yilishi: Predmet soha ma`lumotlar bazasi shakllantirilgandan so`ng undan unumli foydalanishni tashkil etish maqsadida TOP, LIMIT yoki ROWNUM lar orqali so`rovlar yaratish.
Uslubiy ko`rsatmalar: SQL LIMIT va SQL TOP operatorlarining vazifasi belgilangan satrlarni chaqirishdan iborat. SQL TOP operatori MS SQL Serverda ishlaydi, SQL LIMIT operatori esa MySQLda va Oracle da ROWNUM operatori ishlaydi ularnig vazifasi bir hil.
SQL Server / MS Access Syntax:
SELECT TOP number|percent column_name(s)
FROM table_name
WHERE condition;
MySQL Syntax:
SELECT column_name(s)
FROM table_name
WHERE condition
LIMIT number;
Oracle Syntax:
SELECT column_name(s)
FROM table_name
WHERE ROWNUM <= number;
Misol. MS SQL Serverda ishlash
SELECT TOP 3 * FROM Customers;
SELECT * FROM Customers
LIMIT 3;
Misol. Oracleda ishlash
SELECT * FROM Customers
WHERE ROWNUM <= 3;
Ishni bajarish tartibi
Avvalgi bajargan students nomli jadvalni chaqirib olamiz.
SELECT * FROM students;
So`rov: SELECT * FROM students LIMIT 3;
Buyrug`ini kiritamiz natijada birinchi uchta satr hosil bo`ladi
Natija:
13.1 – rasm. Limit operatori orqali 3 ta qatorni ekranga chiqarish
So`rov: Select fish_nomi FROM students LIMIT 2,3;
Buyrug`ini yozamiz, natijada 2, 3 satrlar hosil bo`ladi.
Natija:
13.2 – rasm. Limit operatori orqali 2,3 qatorni ekranga chiqarish
So`rov: SELECT fish_nomi FROM students
ORDER BY fish_nomi DESC LIMIT 2,3;
Natija:
13.3 rasm
Foydalanilgan Adabiyotlar:
www.w3schools.com
Sql we learn
Learn SQL
|
| |