5시간코딩
[행/열제어] salary가 5000이상 10000이하 인 사원의 employee_id, last_name, salary를 출력하세요. 본문
[행/열제어] salary가 5000이상 10000이하 인 사원의 employee_id, last_name, salary를 출력하세요.
5시간코딩 2019. 4. 4. 02:191. oracle
select employee_id, last_name, salary from employees where salary between 5000 and 10000;explain plan for
select employee_id, last_name, salary
from employees
where salary between 5000 and 10000;
select * from table(dbms_xplan.display(null,null,'typical'));
------------------------------------------------------------------------------- |
2. r
1)
emp = read.csv("c:/data/employees.csv",header=T,stringsAsFactors = F)
emp[emp$SALARY>=5000 & emp$SALARY<=10000,c('EMPLOYEE_ID','LAST_NAME','SALARY')]
2)
subset(emp,SALARY>=5000,select=(c('EMPLOYEE_ID','LAST_NAME','SALARY')))
3)
library(dplyr)
emp%>%
filter(SALARY>=5000 & SALARY<=10000)%>%
select(c(EMPLOYEE_ID,LAST_NAME,SALARY))
4)
library(sqldf)
sqldf("select employee_id, last_name, salary
from emp
where salary>5000 and salary<=10000")
3. python
1)
import csv
file = open("c:/data/employees.csv","r")
emp_csv = csv.reader(file)
title = [next(emp_csv)] #리스트 씌우기
res=[]
for i in emp_csv:
if (int(i[7])>=5000) & (int(i[7])<=10000):
res.append([i[0],i[2],i[7]]) #리스트 씌우기
print(res)
#확인용 pd.DataFrame(res)
2)
emp.loc[(emp['SALARY']>=5000) & (emp['SALARY']<=10000),['EMPLOYEE_ID','LAST_NAME','SALARY']]
emp[['EMPLOYEE_ID','LAST_NAME','SALARY']][(emp['SALARY']>=5000) & (emp['SALARY']<=10000)]