ZKX's LAB

数据库相关的面试题 数据库存储过程有哪些,面试题

2021-04-23知识5

数据库面试题,大家看一下 where 是定义的一个条件,只有符合条件的才能显示出来,而第一个是遍历显示

数据库面试题 createdatabaseaaa;createtableusers(idintNOTNULLAUTO_INCREMENT,user_namechar(10),moneychar(10),add_timedatetimePRIMARYKEY(`id`))ENGINE=InnoDBAUTO_INCREMENT=2DEFAULTCHARSET=utf8;3.insertintousersvalues(2,'a1','a11',current_date),(3,'a1','a11',current_date),(4,'a1','a11',current_date),(5,'a1','a11',current_date),(6,'a1','a11',current_date),(7,'a1','a11',current_date),(8,'a1','a11',current_date),(9,'a1','a11',current_date),(10,'a1','a11',current_date),(11,'a1','a11',current_date);4.参考第二步5.参考第三步6.selecta.username,a.money,b.email,b.user_phone,b.weighfromusersa,user_infobwherea.id=b.idanda.id=XXX(你指定的);7.mysqldump-uroot-paaa>;/tmp/aaa.sql(需要输入密码)我用的是mysql上的写法

一道数据库面试题(高分) 楼上的答案是错的,集函数是不能这么用的以下是正确答案,可以包含多级所属关系insert into REPORTTOTAL(REPID,REPNAME,REPDATE,ORGID,CELLID TOTAL_VALUE)select repid,repname,repdate,(select orgid from org where orgname='国有商业银行'),'1A',sum(value)from reportdatawhere REPNAME='资产负债表'and REPDATE='2009-03-31'and ordid in/*找到所有子机构ORGID*/(select CHILDORGIDfrom ORGRLTconnect by parentorgid=prior childorgidstart with parentorgid=(select orgid from org where orgname='国有商业银行'))group by repid,repname,repdate)/*使用报告ID,名称,日期分组*/

随机阅读

qrcode
访问手机版