枞表转横表 select product_id ,max(case when field='test1' then 1 else 0 end) as test1 ,max(case when field='test2' then 1 else 0 end) as test2 ,max(case wh
今天网龙笔试遇到了几个SQL题,现在顺便就总结一下常用的SQL操作。 内连接:只将符合条件的行显示出来 左连接:将左表所有的行显示,右表只显示符合条件的行 全连接:将所有行都显示出来,不论两表是否有符合的对应项 复制A表 将A表的column为1的结果抽取给B表 根据column为B表建立降序索引
select * into tb1 from tb2 insert into tb1 (fld1, fld2) select fld1, 0 from tb2 where fld0='x' 以上两句都是将 源表 的数据插入到 目标表,但两句又有区别的: 第一句(select into from)要求
问题:创建Oracle数据库出现ORA-12705:Cannot access NLS data files or invalid environment specified。 环境:重置系统,无Oracle软件残留,新装Oracle数据库,正常配置Listen,创建数据库最后一步时抱错。 分析:检
问题背景 线上监控发现mysql慢查询,mysql最大执行时间60s,接口p99耗时1.88s 优化记录 检查索引 show create table xxx 线上query条件比较复杂,有接近10个查询字段,主要字段都已经加索引 检查索引顺序 explain select x from x whe
select output from tablewhere date ="20220125" and get_json_object(replace(output, '.', '_'), '$.features.xxx') IS NOT NULL limit 10
Copyright © 2005-2025 51CTO.COM 版权所有 京ICP证060544号