- sys권한 접근
sqlplus sys/oracle as sysdba
- hr 계정 접속
SQL> conn hr/hr;
ERROR:
ORA-28000: the account is locked
- 실패 시 관리자 권한으로 돌아가서 권한 부여
ALTER USER hr IDENTIFIED BY hr ACCOUNT unlock;
- CMD 창에서 작업 시 깨짐 현상 해결
set linesize 300;
set pagesize 100;
- desc 명령어
SQL> DESC employees;
- 컬럼 이름 대신 리터럴 문자, 리터럴 상수 사용하여 출력
SQL> select employee_id, first_name, 'very good~~' from employees;
- 연결 연산자의 사용
select first_name || last_name from employees;
- 연결 연산자 + 공백문자 넣기
SQL> select first_name ||' '|| last_name as name from employees;
- 중복 문자 제거
SQL> select department_id from employees; <-- X
SQL> select distinct department_id from employees;
- 연산+Where절 추가된 쿼리문
SQL> select first_name, salary, salary/12 as month
2 from employees
3 where salary between 10000 and 20000;
- IN 연산자로 특정 조건 조회
SQL> select first_name, salary, salary/12 as month
2 from employees
3 where first_name in('Neena', 'Den', 'Peter');
- LIKE 연산자로 비슷한 것 출력
SQL> select first_name, salary, salary/12 as month
2 from employees
3 where first_name like 'L%';
SQL> select first_name, salary, salary/12 as month
2 from employees
3 where first_name like 'L__s';
'문돌이의 IT > Oracle' 카테고리의 다른 글
[방통대 컴퓨터과학과]데이터베이스의 이해 요약(2) (0) | 2017.05.02 |
---|---|
[방통대 컴퓨터과학과]데이터베이스의 이해 요약 (0) | 2017.05.01 |
오픈소스DB mariadb 설치하기 (0) | 2016.12.07 |
데이터베이스 쿼리문 연습 (0) | 2016.07.29 |
Oracle 테이블스페이스 테이블 유저 생성하기 (0) | 2016.07.28 |