20180505学习笔记_linux面试题、Oracle

mysql:3306

sqlserver:1433

Oracle:1521


windows共享盘挂载:

mount -t cifs -o username=byf,password=byf //192.168.1.100/share /mnt/server


ls -lR /var/log/ | grep "-" | wc -l  ------->统计目录下的文件个数

ls -lR /var/log/ | grep "d" | wc -l  ------->统计目录下的目录个数


统计本地服务器上每个IP的连接数:

扫描二维码关注公众号,回复: 150222 查看本文章

netstat -n | awk '/^tcp/ {print $5}' | awk -F : '{print $1}' | sort | uniq -c | sort -rn


Oracle DB:

本次学习使用的是oracle 10g. 版本是10.2.0.1.0

可通过PLSQL Developer导入脚本。命令格式为@脚本路径.e.g:@d:/abc.sql


DML: data manipulation language 数据操纵语言 (select、insert、update、delete)

DDL: Data Definition language 数据定义语言 (主要用在改变表结构、数据类型等.create、alter、drop)

DCL: Data Control language 数据控制语言(设置或更改数据库用户或角色的语句.grant、deny、revoke)


相关命令:

desc tablename:查看表信息

||:用于列之间的连接符 e.g:select id || ',' || name from table

distinct:去重复 select distinct dep_id from table_hr

like:模糊查询 where name like '%a%' or '__a%'('%\_%' escape \,这里的escape定义\为转义符)

空:is null 非空: is not null

排序: order by [asc|desc] 正序|倒序  order by id asc,salary desc

to_char:转换函数

(not)between: 在两个值之间,包含边界


函数:

lower:小写  upper:大写  initcap:首字母大写

concat('hello','world')   结果:helloworld    作用:连接

substr('helloworld','1,5)   结果:hello          作用:显示从1开始到第5个字母

length('hello')                 结果:5                作用:计算字符串长度

instr('hellojava',l)            结果:                   作用:判断后面字母首次出现的位置
lpad(salary,10,'*')            结果:****543454   作用:用*左补齐10位的salary列数据

lpad(salary,10,'*')            同上                      右补齐

replace('abcd','b','m')      amcd                   用m替换abcd中的b

TRIM('h' from hellworld)    ellworld           去除收尾的h

数字函数:

round(数字,位数)    四舍五入

trunc(数字)          不管小数点后面数字多少,都截断

mod(数字/数字)    求余

month_between(日期,日期)   两个日期相差的月数

add_months(sysdate,2)  向指定日期加上若干月数(2个月)

next_day(日期,星期几):指定日期的下一个星期几对应的最近日期

last_day:本月的最后一天


猜你喜欢

转载自blog.csdn.net/dumplingOba/article/details/80210325