• <nav id="cwumo"><code id="cwumo"></code></nav>
  • <menu id="cwumo"><strong id="cwumo"></strong></menu>

    sql server面試試題

    時間:2024-09-02 06:48:34 面試筆試 我要投稿
    • 相關推薦

    sql server面試試題


    question:howcanilistnon-contignousdata?
    indatabasepubs,icreateatabletestusingstatementasbelow,andiseveralrowasbelow

    sql server面試試題


    &nbsp程序代碼
    createtabletest
    (idintprimarykey)
    go


    intotestvalues(1)
    intotestvalues(2)
    intotestvalues(3)
    intotestvalues(4)
    intotestvalues(5)
    intotestvalues(6)
    intotestvalues(8)
    intotestvalues(9)
    intotestvalues(11)
    intotestvalues(12)
    intotestvalues(13)
    intotestvalues(14)
    intotestvalues(18)
    intotestvalues(19)
    go



    nowiwanttolisttheresultofthenon-contignousrowasbelow,howcanidoit?


    &nbsp程序代碼
    missingaftermissingbefore
    ——————-———————
    6&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp8
    9&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp11


    &nbsp



    answer:
    selectidfromtesttwherenotexists(select1fromtestwhereid=t.id+1)
    ornotexists(select1fromtestwhereid=t.id-1)


    question:howcanilistallbookwithpricesgreatherthantheaveragepriceofbooksofthesametype?
    indatabasepubs,haveatablenamedtitles,itscolumnnamedpricemeanthepriceofthebook,andanothernamedtypemeanthetypeofbooks.
    nowiwanttogettheresultasbelow:


    &nbsp程序代碼
    type&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsptitle&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspprice&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
    ————————————————————————————————————————————————————————-
    business&nbsp&nbsp&nbsp&nbspthebusyexecutive''sdatabaseguide&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp19.9900





    answer:


    &nbsp程序代碼
    selecta.type,a.title,a.pricefromtitlesa,
    (selecttype,price=avg(price)fromtitlesgroupbytype)b
    wherea.type=b.typeanda.price&gtb.price

    【sql server面試試題】相關文章:

    金蝶的SQL筆試題10-27

    SQL Server開發人員應聘常見問題妙解10-07

    面試的筆試題10-20

    面試題精選?08-10

    文員面試的試題!07-05

    面試題精選07-11

    網管面試題總結 面試題目分享08-10

    面試試題早知道:華為面試題08-02

    分享面試題目 教育職業面試題09-26

    名企面試試題 面試題目 Google09-12

    日韩激情