易截截图软件、单文件、免安装、纯绿色、仅160KB

shell中使用SQL实现查询

 先把文本进行格式处理,然后以空格为分隔符,取第二个空格后的字串,排序,去重,再降序排列,取前5个
arr=($(cat 0100055F_Detail.txt|sed -e '/:/d'|awk -F ' ' '{print$2}'|sort|uniq -c|sort -nr|head -5|awk '{print $2}'))
len=${#arr[@]}  获取数组长度
for((i=0;i<$len;i++))
do
echo ${arr[$i]}
mysql -uroot -p123456 -e "select location from IPLocation.IPLocation where IP_address='${arr[$i]}'"|sed 's/\t/,/g' >> table.csv   执行查询:-u后是用户名,-p后事密码,-e表示执行;
done
cat table.csv|sed -e '/location/d'>table1.csv
paste -d ',' result.csv table1.csv >last.csv 两个文件按列合并,并且两文件的结合列中用逗号分隔。


相关文档:

Oracle常用Sql语句

1. 创建视图:
CREATE OR REPLACE VIEW SM_V_UNIT_AUTH AS
SELECT T2.UNIT_ID,
        T2.SUPER_UNIT_ID,
        T1.AUTH_ID,
        T1.AUTH_NAME,
        T1.A ......

1.The SQL introuduction

Introducing Oracle Database 11g
List the features of Oracle Database 11g
Discuss the basic design, theoretical and physical aspects of a relational database
Categorize the different types of SQL statements
Describe the data set used by the course
Log onto the database using the SQL Develope ......

远程备份sql数据库到本机

 条件:
    拥有sa权限
    开启 xp_cmdshell
方法:
 开启/关闭 xp_cmdshell 必须在 master  库执行
EXEC sp_configure 'show advanced options', 1 
RECONFIGURE WITH OVERRIDE 
EXEC sp_configure 'xp_cmdshell', 1 
RECONFIGURE ......

SQL SERVER日期时间函数

 来源http://hi.baidu.com/smilevt/blog/item/04bddeef0fe3f42e2cf5348b.html这里还有很多sql server的帖子
1. 当前系统日期、时间
select getdate()
2. dateadd 在向指定日期加上一段时间的基础上,返回新的 datetime 值
例如:向日期加上2天
select dateadd(day,2,'2004-10-15') --返回:2004-10-17 00:00:00. ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号