• So`rov: Select Left(korpus_nomi,5) as korpus_nomi from korpus; Natija: Left()
  • So`rov: Select Right(korpus_nomi, 4) as korpus_nomi from korpus; Natija: Right()
  • MS SQL Server
  • So`rov: Select id, FISH, turar_joyi, LTRM(turar_joyi), RTRM(turar_joyi) from master




    Download 2,48 Mb.
    bet11/17
    Sana13.01.2024
    Hajmi2,48 Mb.
    #136474
    1   ...   7   8   9   10   11   12   13   14   ...   17
    Bog'liq
    ma\'lumotlar bazasi

    So`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

    Download 2,48 Mb.
    1   ...   7   8   9   10   11   12   13   14   ...   17




    Download 2,48 Mb.

    Bosh sahifa
    Aloqalar

        Bosh sahifa



    So`rov: Select id, FISH, turar_joyi, LTRM(turar_joyi), RTRM(turar_joyi) from master

    Download 2,48 Mb.