Common SQL

select Row_Number() over( order by getdate() ) as SN,* from table

exec sp_helptext spRpt_R169_v2

SELECT  b.name  as  TableName,a.name  as  columnname  
From  syscolumns   a  INNER  JOIN    sysobjects  b    
ON  a.id=b.id      
AND  a.name like ‘plan%‘;

select [day]=day(order_entered_dt)
from dbo.SM_Comm_CompMapping
where month(order_entered_dt)=4 and year(order_entered_dt)=2015
group by day(order_entered_dt)
order by day(order_entered_dt)

datediff(dd, s.Order_Entered_dt, getdate())< 30

时间: 2024-10-22 21:47:53

Common SQL的相关文章

Common SQL for Oracle---(1)AWR Generator

AWR Generator ------------- -- query snapid SELECT   dbid, instance_number, MIN (snap_id) begin_snap_id, MAX (snap_id) end_snap_id FROM   dba_hist_snapshot WHERE    end_interval_time >= to_date('2014/06/29 07:00:00', 'yyyy/mm/dd hh24:mi:ss') and end_

Common SQL for Oracle---(2)Check TableSpace

-----Check TableSpace----- ---Check DataFile SELECT TABLESPACE_NAME "TABLESPACE", FILE_NAME "DATAFILE", ROUND(BYTES / (1024 )) "FILE_SIZE(KB)" FROM DBA_DATA_FILES WHERE TABLESPACE_NAME LIKE '&TABLESPACE' ORDER BY DATAFILE

Common SQL for Oracle---(3)Check Execution Plan

---Check Execution Plan---- [email protected] select plan_table_output from table (dbms_xplan.display_awr('&sql_id',null,null,'ADVANCED +PEEKED_BINDS')); ---all [email protected] SELECT A.INSTANCE_NUMBER, A.SNAP_ID, A.SQL_ID, A.PLAN_HASH_VALUE, to_ch

SQL Server专家的10个秘诀(翻译加注解)

当你点开这篇文章的时候,如果觉得没有读下去的必要,也希望你能拉到最后看看那几行字! 原文出处:https://technet.microsoft.com/en-us/magazine/gg299551.aspx 译者注: 本文主要以翻译为主,但由于工作经历,译者也有一些自己的看法和心得,并且不打算完全照搬直译,期间过滤了一些本人觉得无关紧要的信息,如果读者觉得看的别扭,可以看原文. 这篇文章可能已被广为流传和翻译,但是只要本人觉得有必要的,都会翻译或者直接公布原文,因为我相信总有人没有发现.并且

Statistics gathering and SQL Tuning Advisor

1. https://www.pythian.com/blog/statistics-gathering-and-sql-tuning-advisor/ Our monitoring software found a long running job on one of our client's databases. The job was an Oracle's auto task running statistics gathering for more than 3 hours. I wa

mongodb 语句和SQL语句对应(SQL to Aggregation Mapping Chart)

SQL to Aggregation Mapping Chart https://docs.mongodb.com/manual/reference/sql-aggregation-comparison/ On this page Examples Additional Resources The aggregation pipeline allows MongoDB to provide native aggregation capabilities that corresponds to m

10 Easy Steps to a Complete Understanding of SQL

原文出处:http://tech.pro/tutorial/1555/10-easy-steps-to-a-complete-understanding-of-sql(已经失效,现在收集如下) Too many programmers think SQL is a bit of a beast. It is one of the few declarative languages out there, and as such, behaves in an entirely different w

mybatis公用代码抽取到单独的mapper.xml文件

同任何的代码库一样,在mapper中,通常也会有一些公共的sql代码段会被很多业务mapper.xml引用到,比如最常用的可能是分页和数据权限过滤了,尤其是在oracle中的分页语法.为了减少骨架性代码,通常将它们抽象到sql中,但是肯定又不能在每个mapper中也包含,这样就没有意义了.此时,可以将这部分移到专门的mapper.xml中,比如common.xml,其中包含如下: <?xml version="1.0" encoding="UTF-8"?>

CentOS安装Oracle11g &nbsp; Linux 搭建Pro*C/C++开发环境

[本文谢绝转载原文来自http://990487026.blog.51cto.com] 系统属性: CentOS 6.8_X64,基于桌面,附加开发工具包安装. 上传Oracle11g安装文件到:/usr/local/oracle/ [[email protected] home]# mkdir -pv /usr/local/oracle mkdir: created directory `/usr/local/oracle' [[email protected] oracle]# ll /us