|
So`rov: Select id, FISH, turar_joyi, LTRM(turar_joyi), RTRM(turar_joyi) from master
|
bet | 11/17 | Sana | 13.01.2024 | Hajmi | 2,48 Mb. | | #136474 |
Bog'liq ma\'lumotlar bazasiSo`rov: Select id, FISH, turar_joyi, LTRM(turar_joyi), RTRM(turar_joyi) from master;
Natija:
LTRIM(), RTRIM() funksiyalarining qo’llanishi
9. LEFT(qator,miqdor) – qatorning chap tomonidan, ko’rsatilgan miqdordagi belgilarni qaytaradi.
So`rov: Select Left(korpus_nomi,5) as korpus_nomi from korpus;
Natija:
Left() funksiyasining qo’llanishi
10. RIGHT(qator, miqdor) - qatorning o’ng tomonidan, ko’rsatilgan miqdordagi belgilarni qaytaradi;
So`rov: Select Right(korpus_nomi, 4) as korpus_nomi from korpus;
Natija:
Right() funksiyasining qo’llanishi
Mavzu: Murakkab so‘rovlar yaratish
SQL LIMIT va SQL TOP operatorlarining vazifasi belgilangan satrlarni chaqirishdan iborat. SQL TOP operatori MS SQLServerda 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;
Misol. SQL da ishlash
SELECT * FROM Customers
LIMIT 3;
Misol. Oracleda ishlash
SELECT * FROM Customers
WHERE ROWNUM <= 3;
Ishni bajarish tartibi
Avvalgi bajargan korpus nomli jadvalni chaqirib olamiz.
SELECT * FROM korpus;
1. So`rov: SELECT * FROM korpus LIMIT 3;
Buyrug`ini kiritamiz natijada birinchi uchta satr hosil bo`ladi
|
| |