20180505 study notes _linux interview questions, Oracle

mysql:3306

sqlserver:1433

Oracle:1521


Windows shared disk mount:

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


ls -lR /var/log/ | grep "-" | wc -l -------> count the number of files in the directory

ls -lR /var/log/ | grep "d" | wc -l -------> count the number of directories in the directory


Count the number of connections per IP on the local server:

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


Oracle DB:

This study uses oracle 10g. The version is 10.2.0.1.0

Scripts can be imported via PLSQL Developer. The command format is @script path.eg: @d:/abc.sql


DML: data manipulation language (select, insert, update, delete)

DDL: Data Definition language data definition language (mainly used to change table structure, data types, etc. create, alter, drop)

DCL: Data Control language Data Control Language (statements to set or change database users or roles. grant, deny, revoke)


Related commands:

desc tablename: View table information

||: used for connectors between columns eg: select id || ',' || name from table

distinct: deduplicate select distinct dep_id from table_hr

like: fuzzy query where name like '%a%' or '__a%' ('%\_%' escape \, where escape defines \ as an escape character)

Empty: is null Not empty: is not null

Sort: order by [asc|desc] positive order|reverse order order by id asc,salary desc

to_char: conversion function

(not)between: between two values, including boundaries


function:

lower: lowercase upper: uppercase initcap: first letter uppercase

concat('hello','world') result: helloworld function: connect

substr('helloworld','1,5) Result: hello Function: Display the letters from 1 to 5

length('hello') Result: 5 Function: Calculate the length of the string

instr('hellojava',l) Result: Function: Determine the position of the first occurrence of the following letter
lpad(salary,10,'*') Result: ****543454 Function: Fill the 10-digit salary column data with * left

lpad(salary,10,'*') Same as above, right padding

replace('abcd','b','m') amcd replace b in abcd with m

TRIM('h' from hellworld) ellworld remove the ending h

Numeric function:

round(number, digit) rounding

trunc(number) truncates regardless of the number of digits after the decimal point

mod(number/number) remainder

month_between(date, date) The number of months between two dates

add_months(sysdate,2) adds a number of months (2 months) to the specified date

next_day (date, day of the week): the latest date corresponding to the next day of the week of the specified date

last_day: the last day of the month


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325631155&siteId=291194637