一道資料庫筆試題
有一張表,記錄遊戲使用者id和它的等級,讓你計算 通關率=對每個等級,大於該等級的人數/大於等於該等級的人數。
解法:
首先統計每個等級人數到臨時表(用group by);
create table tmp select count(user_id) as cnt, grade from users group by grade;
然後計算每個等級的通關率(用臨時表自連線):
select tmp2.grade, tmp2.cnt/sum(tmp1.cnt) as gl from tmp as tmp1, tmp as tmp2 where tmp1.grade >= tmp2.grade group by tmp2.grade;
相關推薦
一道資料庫筆試題
有一張表,記錄遊戲使用者id和它的等級,讓你計算 通關率=對每個等級,大於該等級的人數/大於等於該等級的人數。 解法: 首先統計每個等級人數到臨時表(用group by); create table tmp select count(user_id) as cnt, gra
關於一道遊戲筆試題
限制 pre signed 題目 pan log blog tar sta 如何出BOSS. 每兩個小時要隨機出一個BOSS提供: 隨機函數unsigned int random(void), 返回值是一正隨機整數, 取當前時間函數unsigned int GetCur
資料庫筆試題【20181025】
一 . 資料庫索引 1.什麼是索引 在資料庫中,索引的含義與日常意義上的“索引”一詞並無多大區別(想想小時候查字典),它是用於提高資料庫表資料訪問速度的資料庫物件。 A)索引可以避免全表掃描。多數查詢可以僅掃描少量索引頁及資料頁,而不是遍歷所有資料頁。 B)對於非聚集索引,有些查
木子網羅資料庫筆試題(一)
1.問:刪除表資料,同時保留表結構,()方法比()方法效率高 A.delete B.drop table C.truncate table D.delete all 答:C,A 解析: truncate table 命令將快速刪除資料表中的所有記錄,但保留
資料庫筆試題及答案
以下為某公司的資料庫筆試題及個人整理的答案,小夥伴們有更好的答案歡迎指教!資料表Student(S#,Sname) 10000條記錄Cource(C#,Cname,T#)9條記錄SC(S#,C#,Score)89991條記錄Teacher(T#,Tname) 3條記錄題目並沒
資料庫筆試題
【選擇題】 1、下列哪個ORACLE函式可以取得資料庫系統時間:() A、TIME B、DATE C、SYSTIME D、SYSDATE 2、下面選項哪些屬於ORACLE中定義的資料型別:() A、NUMBER B、STRING C、INT
資料庫筆試題(2)
資料庫筆試題 姓名 日期 一、選擇題 1、當你執行一下查詢語句:SELECT empno, ename FROM emp WHERE empno=7782 OR empno=7876; 在WHERE語
一道shell筆試題
1. 題目 一個包含ip的文字檔案ip.txt,要求用shell命令統計每個ip出現的次數,並按降序排序 2. 解答 文字處理,行單位處理,用awk awk '{num[$1]++} END{for(k in num)print k,"----",n
一道阿里筆試題解析--程式調優
下列方法中,____不可以用來程式調優? A.改善資料訪問方式以提升快取命中率 B.使用多執行緒的方式提高 I/O 密集型操作的效率 C.利用資料庫連
資料庫筆試題 (3)
一、選擇題(每題1分)[選擇題: 1.A 2.C 3.D 4.B 5.C 6.C 7.C 8.D 9.C 10.A 11.D 12.B 13.C 14.C 15.
C++ 一道基礎筆試題
C++函式: int foo(int x) { return x&-x; } 呼叫函式 foo(2^31 - 3)得到的結果是什麼? ^ 的優先順序高於 - ;所以 2^31 - 3 = 30; 30 & -30 = 0
indeed一道線上筆試題
String Arrangement Time limit時間制限 : 2sec / Stack limitスタック制限 : 256MB / Memory limitメモリ制限 : 256MB Problem Mr. Takahashi is poor
一道經典筆試題
下面是一道經典的面試題:try {}裡有一個return語句,那麼緊跟在這個try後的finally {}裡的code會不會被執行,什麼時候被執行,在return前還是後? 很多人回答return在後,但是所給的理由不夠充分;或者有些說return在前如http://bbs.csdn.net/topics
一道筆試題引發的對Object.creat()的思考
是否 理解 成了 使用 style 控制 現在 __proto__ alt 今天晚上參加了酷家樂的筆試,有一道選擇題讓我有點猶豫,現在放出來讓大家先思考一下。 (憑記憶敲出來的代碼,有錯望雅正) 憑上面的這段代碼,我們可能首先會想 a 和 b 是不是引用同一個對象,從Ob
golang 中 string 轉換 []byte 的一道筆試題
ogr 常用 general hub 代碼 seq mmu gen cati 背景 去面試的時候遇到一道和 string 相關的題目,記錄一下用到的知識點。題目如下: s:="123" ps:=&s b:=[]byte(s) pb:=&b s+="4" *
2018今日頭條春招的一道筆試題 —— 通過改變枚舉的變量進行枚舉優化
圖片 strong uno class stl BE lose ostream erase 題目如下: 這道題我們最先想到的做法,應該就是2重循環枚舉數對,然後把數對放在set裏去重,最後輸出set的大小,即輸出set.size( )。代碼如下: 1
一道簡單的 Java 筆試題,但值得很多人反思!
前言 面試別人,對我來說是一件新奇事,以前都是別人面試我。我清楚地知道,我在的地域與公司,難以吸引到中國的一流軟體人才。所以,我特地調低了期望,很少問什麼深入的技術問題,只問一些廣泛的、基礎的。我只要最終給Leader一句“這個人技術還行/很好/非常好”,就行了。至於其它能力、綜合水平,由別人把
今天遇到了一道沒有見識過的筆試題,在這裡跟大家分享下,也算是自己做個記錄:
題目:如何優化for(int i=0;i<list.size();i++){...} 平時我一般就是這麼寫的,沒有想過這個問題;然後百度下發現這樣: for(int i=0,len=list.size();i<len;i++){...}就可以優化了;因為判斷條
恆生電子公司的一道筆試題,有一個字串由*號和其他字母組成,請提供函式將字串頭部的*號全部移到字串的尾部(***aqer*f轉換成aqer*f***)
現場筆試的時候沒有寫出來,筆試之後想了一下,就編寫了一下,用的方法很簡單,主要用vector實現的。以下貼上自己編的原始碼: #include<iostream> #include<string> #include<vector> u
恆生電子筆試題資料庫及演算法整理記錄
一、資料庫 AccoInfo 賬戶編號 使用者名稱 餘額 id name balance AccoCurrent_201811 賬戶編號 流水金額 時間 id amount time AccoCurrent_201812