SQL 연습문제
연습문제1) 돈을 벌기 위해 일을 합시다!
승따리
2024. 5. 29. 18:08
1) 모든 직원의 이름과 직급을 선택 하는 쿼리
select name,
positon
FROM practice1
2) 중복없이 모든 직급을 선택하는 쿼리
select distinct position
FROM practice1
3) 연봉이 40000과 60000 사이인 직원들을 선택하는 쿼리 select when salary >= 40000 and salary <=60000 '4~60000사이' from sparta_employees
select name,
salary '4~60000사이'
FROM practice1
where salary >= 40000 and salary <=60000
4)입사일이 2023년 1월 1일 이전인 모든 직원들을 선택 select when datadiff(hire_data, '2023-01-01) < 0 '20230101 이전 입사' from sparta_employees
select name,
hire_date
FROM practice1
where datediff('2023-01-01',hire_date)>0