분류 전체보기
-
3-1. WHERE절을 이용한 조건 검색Oracle DB 2016. 5. 3. 16:36
WHERE절은 테이블에 저장된 데이터 중에서 원하는 데이터만 선택적으로 추출하기 위해 사양된다. 여기서 WHERE절에서 사용하는 데이터 타입은 숫자, 문자, 날짜 등 다양한 데이터 타입이 사용되는데 문자나 날짜타입의 상수는 반드시 작은따옴표('')로 묶어서 표현해야 한다. - 비교 연산자 WHERE 절에는 숫자, 문자, 날짜의 크기나 순서를 비교하기 위해 사용하는 연산자로 아래와 같은 연산자가 있다. 연산자 의미 = 같다 > 보다 크다. = 보다 크거나 같다. >= 보다 작거나 같다. , !=, ^= 같지 않다. 문자데이터 조회는 ''로 묶어서 사용해야 한다. 문자열을 ''로 묶지 않으면 오류가 난다. 또한 데이터베이스 안에 데이터는 대소문자를 구분하기 때문에 주의해야 한다. 날짜 데이터 역시 ''로 묶..
-
2. SELECT문Oracle DB 2016. 5. 3. 13:50
SELECT 문 SELECT은 결과로 출력될 컬럼을 선택하는 것이고 FROM은 테이블 명을 의미한다. 몇가지 예를 들어보면 SELECT last_name FROM employees; 의 내용은 employees의 테이블에서 last_name의 속성을 추출하는 것이다. 여기서 SELECT문 안의 특징으로 사칙연산을 쓸 수 있다. dual은 한 행으로 결과를 출력하기 위해 제공되는 테이블로서 오라클에서 자동으로 생성된다. dual 테이블은 dummy라는 하나의 칼럼으로 구성되어 있으며 한 개의 행을 포함하고 있다. dual 테이블의 유일한 칼럼인 DUMMY는 X라는 데이터만을 저장하고 있어 한개의 행으로 구성되어 있다. DUMMY칼럼에 저장된 값은 아무 의미가 없다. 사용자가 계산이나 함수를 실행한 후 결과..
-
1. Oracle DB 시작Oracle DB 2016. 5. 2. 10:39
처음 시작은 cmd 창에서 sqlplus "sys/as sysdba"로 접속한다. 자동 생성된 hr 계정에 접근하기 위해 conn hr/hr을 작성하면 에러가 나오기 때문에 sys관리자로 접근해 계정의 LOCK을 풀어줘야 한다. 접속이 안될 시 name에 system, password는 설치시 설정했던 비밀번호를 입력하면 된다. cl scr을 사용하면 화면이 clear된다. 아무튼 conn sys로 먼저 관리자로 접속한다. ENTER PASSWORD : 옆에는 as sysdba를 입력한다. 아무 변화가 없지만 입력중이므로 그래도 작성하고 엔터. ALTER user hr account UNLOCK; 는 hr계정의 LOCK을 풀어 접근이 가능하게 하고 ALTER user hr IDENTIFIED BY hr;..