Programming/SQL
SQL / 컬럼 조회 / Where 조건 / Order by 정렬 / Oracle 오라클
with chu
2021. 3. 13. 21:36
728x90
SQL 컬럼 리스트 조회
전체 컬럼 조회
SQL> select * from tab;
desc : data dictionary 조회 (칼럼목록 조회)
SQL> desc emp;
distinct : 중복된데이터 빼고 조회
SQL> select distinct job
2 from emp;
제약조건 확인
SQL> desc user_constraints;
dba_XXXX => db관리자용
all_XXXX => 자신/권한받은거
user_XXXX => 자기계정
where절 비교연산자 (요약)
where hiredate >= '1982/1/1';
where deptno=20 or deptno=30;
where deptno in (10,20);
where ename like '%M%';
where comm is not null;
where job not in ('MANAGER' , 'ANALYST')
order by 정렬
order by job desc, hiredate asc;
order by 평균; # 정렬 시 alias(별칭) 쓸 수 있다.
desc : 내림차순, asc : 오름차순 (기본값)
728x90