#!bin/bash#作者:liusingbon#功能:统计 Linux 进程相关数量信息,running(运行的进程),sleeping(睡眠中的进程),stoped(停止的进程),zombie(僵尸进程)running=0sleeping=0stoped=0zombie=0#在 proc 目录下所有以数字开始的都是当前计算机正在运行的进程的进程 PID#每个PID编号的目录下记录有该进程相关的信息for pid in /proc/[1-9]*doprocs=$[procs+1]stat=$(
1.统计每分钟内 url 的访问数量 SELECT SUBSTRING(CONVERT(varchar(100), date, 20), 0,17) as dateTime,COUNT(url) as count,url,referer FROM demo GROUP BY url,(SUBSTRING(CONVERT(varchar(100), date, 20), 0,17) ),referer;
def process_line(line, hist): """Adds the words in the line to the histogram. Modifies hist. line: string hist: histogram (map from word to frequency) """ # replace hyphens with spaces before splitting line = l
1.可以使用count SELECT count(name='A' OR NULL) FROM table 2.用sum SELECT sum(if( = 'A', 1, 0)) FROM table 以上只是简单的方式,如遇到复杂的多表查询,可以结合GROUP BY,count() or sum()函数得出对应数据
Given a sequence of n numbers a1, a2, ..., an and a number of d-queries. A d-query is a pair (i, j) (1 ≤ i ≤ j ≤ n). For each d-query (i, j), you have to return the number of distinct elements in the subsequence ai, ai+1, ..., aj. Input Line 1: n (1