日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

新题速看~2021阿里、腾讯、字节都在问的SQL数据库笔试题及答案都给你整理好啦

發布時間:2023/12/20 数据库 22 豆豆
生活随笔 收集整理的這篇文章主要介紹了 新题速看~2021阿里、腾讯、字节都在问的SQL数据库笔试题及答案都给你整理好啦 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

?? 前? 言

2021到了最后一個月份,年后肯定有蠻多小伙伴需要跳槽換工作,但對于年限稍短的軟件測試工程師,難免會需要進行筆試,而在筆試中,基本都會碰到一道關于數據庫的大題,今天這篇文章呢,就收錄了下最近學員反饋上來的一些數據庫筆試真題,包含答案!

1、依據以下學生表、班級表,按要求寫 SQL

答案:

1、
select * from student a
left join class b on a.c_id = b.id
where score = (
select max(score) from student)

2、
select b.name,count(*),avg(score) as avgScore from student a,class b
where a.c_id = b.id
group by b.name
order by avgScore;

2、Table A 保存客戶的基本信息;Table B 保存客戶的資產負債信息。按要求寫 SQL

答案:

(1)select ID from A where name = '李四';
(2)select NO,NAME,ID from A,B where A.NO = B.NO AND DEPOSIT >= 1000;
(3)select COUNTRY,count(*) FROM A GROUP BY COUNTRY;

(4)SELECT '80 后' as 年齡段,sum(CREDIT) AS '信用卡余額' FROM A,B WHERE A.NO = B.NO AND BIRTH >= 19800101 AND BIRTH < 19900101
UNION
SELECT '90 后' as 年齡段,sum(CREDIT) AS '信用卡余額' FROM A,B WHERE A.NO = B.NO AND BIRTH >= 19900101 AND BIRTH < 20000101;

3、數據庫(編寫示例 sql)

答案:

  • select orderNo, if(status=1,'新建','處理中') from OrderTrans;

  • select DATE_FORMAT(a.crttime,'%m-%d-%Y') ,username,count(*) from testCase a,User b where a.crtUser = b.UserId group by DATE_FORMAT(a.crttime,'%m-%d-%Y'),b.username, having status = '成功';

  • select count(*),sum(amount),DATE_FORMAT(crttime,'%m-%d-%Y') from OrderInfo group by
    DATE_FORMAT(crttime,'%m-%d-%Y');

  • 4、現有三張數據表如下:學生資料表:記錄學生基本信息;課程表:記錄課程基本信息;成績表:記錄每人各門課程成績的信息,1 個學生對應多個成績,1 個成績只屬于一個學生,一個課程

    答案:

  • Select * from students where jg = ‘湖北’ and birthday = ‘1992-6-1’ order by no asc;

  • Select avg(so.cj),min(so.cj),max(so.cj),sum(so.cj) from student st,course c,source so where st.no = so.no and c.kebh=so.kebh and st.name = ‘王華’ group by st.no;

  • Select st.no,st.name,st.bj,c.kebh,c.kcmc,so.cj from student st,course c,source so where st.no = so.no and c.kebh=so.kebh and st.name = ‘張三’ order by so.cj desc;

  • 答案:

  • Select Consultant.SubsidiaryID, BaseOrder.* from Consultant, BaseOrder where Consultant.ConsultantID = BaseOrder.ConsultantID and Consultant.SubsidiaryID = 29 order by Orderid desc;

  • Select BaseOrder.ConsultantID,sum(OrderDetails.TotalPrice) from BaseOrder,OrderDetails where BaseOrder.Orderid=OrderDetails.Orderid and month(OrderDate) = 5 group by BaseOrder.ConsultantID;

  • Insert into Consultant (ConsultantID,ConstultantStatusID,SubsidiaryID,Name) values (200000,10,29,’Gary’);

  • Delete from Consultant where Name like ‘%Gary%’;

  • Update BaseOrder set OrderDate = sysdate() where ConsultantID in (select ConsultantID from BaseOrder where ConsultantID=100003 order by OrderDate desc limit 0,1);

  • ?

    ?軟件測試海量資料免費領取點

    總結

    以上是生活随笔為你收集整理的新题速看~2021阿里、腾讯、字节都在问的SQL数据库笔试题及答案都给你整理好啦的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。