1.

ping 을 때리면 알 수 있음

 

ping google.com

 

2.

host 명령을 사용

 

host google.com

 

 

 

 

 

 

 

 

find 와 xargs 를 혼용하여 사용함

현재 위치(.)에서 찾고 싶은 검색어가 'data' 라면

 

grep -r "data" .

혹은

find . | xargs grep -i "data"

혹은

find . -type f | xargs grep -n 'data'

 

 

 

내가 헷갈려서 남겨둠

 

 

Ubuntu


vi ~/.bashrc
source ~/.bashrc

 

Centos


vi ~/.bash_profile
source ~/.bash_profile


vi /etc/profile
source /etc/profile

참고)

/etc/profile : Linux 를 사용하는 모든 사용자들에 적용되는 환경설정 파일
~/.bash_profile : Linux 각 개인 사용자들에 적용되는 환경설정 파일

 

 

PATH 설정 방법 (Ubuntu, Centos)


PATH=$PATH:$HOME/bin
export PATH

export JAVA_HOME=/usr/java/jdk1.6.0_45
export PATH=$PATH:$JAVA_HOME/bin

 

적용이 되었는지 확인하는 방법


echo $JAVA_HOME

 

 

 

 

 

두 가지 방법으로 풀었음

 

1. 서브쿼리를 이용하는 방법


select  c.company_code, c.founder,
(select count(distinct l.lead_manager_code) from Lead_Manager l where c.company_code=l.company_code),
(select count(distinct s.senior_manager_code) from Senior_Manager s where c.company_code=s.company_code),
(select count(distinct m.manager_code) from Manager m where c.company_code=m.company_code),
(select count(distinct e.employee_code) from Employee e where c.company_code=e.company_code)
from Company c
group by c.company_code, c.founder
order by c.company_code asc;

 

2. 모든 테이블을 한 번에 불러와서 쿼리하는 방법


select  c.company_code, c.founder,
count(distinct l.lead_manager_code),
count(distinct s.senior_manager_code),
count(distinct m.manager_code),
count(distinct e.employee_code)
from Company c, Lead_Manager l, Senior_Manager s, Manager m, Employee e
where c.company_code = l.company_code
and c.company_code = s.company_code
and c.company_code = m.company_code
and c.company_code = e.company_code
group by c.company_code, c.founder
order by c.company_code asc;

 

 

 

'SQL' 카테고리의 다른 글

[PostgreSQL] HA 구성하는 방법  (0) 2022.07.25
[Hive] url decoder 예제  (0) 2022.05.05
[MySQL] 여러가지 함수 예제 모음  (2) 2022.02.13
[SQL] WAL 이란 무엇인가?  (0) 2022.02.08
[Phoenix] update values 하는 방법  (0) 2021.11.29

 

 

아래와 같이 describe 명령어를 통해 데이터 타입을 확인 가능

 


batters = LOAD 'hdfs:/home/ubuntu/pigtest/Batting.csv' using PigStorage(',');
filtered_batters = FOREACH batters2 GENERATE $0 as id, $5 as bats;
describe filtered_batters;
filtered_batters: {id: bytearray, bats: bytearray}

 

 

아래와 같이 int 등으로 데이터 타입 변경 가능

 

filtered_batters = FOREACH batters2 GENERATE (int)$0 as id, (int)$5 as bats;

OR

filtered_batters = FOREACH batters2 GENERATE $0 as id:int, $5 as bats:int;
 

 

 

참고

https://stackoverflow.com/a/40835310

+ Recent posts