windows의 관리자 : administrator
linux의 관리자 : root
oracle의 관리자 : sys
서비스를 제공해 주는애가 server
oracle도 객체지향언어
세션 : 로그인 하는동안
세션유지 반대말 : 로그아웃
alt f4 : 창닫기
테이블의 정의 : 1개이상의 column과 0개 이상의 row으로 이루어진 객체
table(entity)
- row(tuple) -> 데이터
- column(attribute) -> 속성(구조) 구성
DB는 글자가 이어질때 _를 주로 사용한다.
메모리 : 컴퓨터 시스템에서 가장 기본적인 데이터 저장 장치로 CPU가 실행 중인 프로그램의 데이터와 상태를 저장하는 데 사용됨.
캐시메모리 : 메모리와 CPU 사이에 위치한 고속의 임시 저장 장치. CPU가 자주 사용하는 데이터를 캐시메모리에 저장하여 CPU의 성능을 향상시킴.
버퍼 : 두 장치 사이에서 데이터를 전송할 때 사용하는 임시 저장 장치. 두 장치의 속도 차이를 보완하고 데이터 손실을 방지하는 데 사용.
★ SQL(=데이터처리언어), SQL plus(SQL실행하는도구) 명령어 알아두기.
SQL과 SQL*Plus는 모두 데이터베이스를 관리하고 데이터에 액세스하는 데 사용되는 도구이지만, 두 도구는 서로 다른 목적을 가지고 있다.
SQL은 관계형 데이터베이스의 표준 언어로, 모든 관계형 데이터베이스에서 동일하게 작동함.
SQL은 데이터베이스에서 데이터를 조회, 삽입, 수정, 삭제하는 데 사용됨.
SQL*Plus는 Oracle 데이터베이스에서 SQL을 실행하기 위한 도구.
SQLPlus는 SQL문을 입력하고 결과를 볼 수 있는 터미널 기반의 도구.
SQLPlus는 또한 SQL 명령문을 저장하고, 환경을 설정하고, 데이터베이스와 상호 작용하는 데 사용할 수 있는 다양한 명령을 제공함.
SQLPlus는 SQL문을 실행하기 위한 도구이기 때문에, SQL은 SQLPlus의 기본이 됨.
SQL*Plus를 사용하여 SQL문을 작성하고 실행할 수 있음.
그러나, SQLPlus는 단순히 SQL문을 실행하는 도구만은 아니고,
SQLPlus는 다양한 기능을 제공하여 데이터베이스를 관리하고 데이터에 액세스하는 데 사용할 수 있다.
<SQL plus>
; 안씀 (한줄코딩)
버퍼기억 x
명령어 : / , l , edit , @ , show , set
파일을 실행할 때 : @
l : list
/ : run
i : input
cd : 경로이동
ed : edit (기존의 파일이 있으면 그게 열리고, 없으면 새로 만들고)
<SQL>
; 필요 (여러줄 코딩 가능)
버퍼기억 o (마지막 명령만)
SQL의 한줄 주석 : --
---------------------------------------------------------------
// SQL plus (cmd에서 실행)
// SQL plus 실습코드 (cmd에서 실행)
Microsoft Windows [Version 10.0.19045.3570]
(c) Microsoft Corporation. All rights reserved.
C:\Users\Koreavc4>sqlplus/nolog --Start SQL*Plus without logging in to a database
SQL*Plus: Release 11.2.0.1.0 Production on 수 10월 25 12:37:54 2023
Copyright (c) 1982, 2010, Oracle. All rights reserved.
SQL> show user --Show the current user
USER은 ""입니다
SQL> conn sys/password as sysdba --Connect to the database as SYSDBA
연결되었습니다.
SQL> conn / as sysdba --Connect to the database as SYSDBA
연결되었습니다.
SQL> show user
USER은 "SYS"입니다
SQL> alter user scott account unlock identified by tiger; --Unlock the SCOTT account and reset the password to TIGER
사용자가 변경되었습니다.
SQL> conn scott/tiger --Connect to the SCOTT schema using the password TIGER
연결되었습니다.
SQL> show user
USER은 "SCOTT"입니다
SQL> select * from tab; --Select all tables from the user_tables view
TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
BONUS TABLE
DEPT TABLE
EMP TABLE
SALGRADE TABLE
SQL> desc emp --Describe the EMP table
이름 널? 유형
----------------------------------------- -------- ----------------------------
EMPNO NOT NULL NUMBER(4)
ENAME VARCHAR2(10)
JOB VARCHAR2(9)
MGR NUMBER(4)
HIREDATE DATE
SAL NUMBER(7,2)
COMM NUMBER(7,2)
DEPTNO NUMBER(2)
SQL> select ename, job from emp; --Select the ENAME and JOB columns from the EMP table
ENAME JOB
---------- ---------
SMITH CLERK
ALLEN SALESMAN
WARD SALESMAN
JONES MANAGER
MARTIN SALESMAN
BLAKE MANAGER
CLARK MANAGER
SCOTT ANALYST
KING PRESIDENT
TURNER SALESMAN
ADAMS CLERK
ENAME JOB
---------- ---------
JAMES CLERK
FORD ANALYST
MILLER CLERK
14 개의 행이 선택되었습니다.
SQL> i --Enter input mode and add an ORDER BY clause to the previous query
2 order by ename; --order
ENAME JOB
---------- ---------
ADAMS CLERK
ALLEN SALESMAN
BLAKE MANAGER
CLARK MANAGER
FORD ANALYST
JAMES CLERK
JONES MANAGER
KING PRESIDENT
MARTIN SALESMAN
MILLER CLERK
SCOTT ANALYST
ENAME JOB
---------- ---------
SMITH CLERK
TURNER SALESMAN
WARD SALESMAN
14 개의 행이 선택되었습니다.
SQL> l --List the current buffer
1 select ename, job from emp --select
2* order by ename --order
SQL> / --Execute the current buffer
ENAME JOB
---------- ---------
ADAMS CLERK
ALLEN SALESMAN
BLAKE MANAGER
CLARK MANAGER
FORD ANALYST
JAMES CLERK
JONES MANAGER
KING PRESIDENT
MARTIN SALESMAN
MILLER CLERK
SCOTT ANALYST
ENAME JOB
---------- ---------
SMITH CLERK
TURNER SALESMAN
WARD SALESMAN
14 개의 행이 선택되었습니다.
SQL> / --run
ENAME JOB
---------- ---------
ADAMS CLERK
ALLEN SALESMAN
BLAKE MANAGER
CLARK MANAGER
FORD ANALYST
JAMES CLERK
JONES MANAGER
KING PRESIDENT
MARTIN SALESMAN
MILLER CLERK
SCOTT ANALYST
ENAME JOB
---------- ---------
SMITH CLERK
TURNER SALESMAN
WARD SALESMAN
14 개의 행이 선택되었습니다.
SQL> del 2 --Delete the second line of the buffer
SQL> l --List the current buffer
1* select ename, job from emp --Replace the first line of the buffer with a new query
SQL> 1 select ename, hiredate from emp --Replace the first line of the buffer with a new query
SQL> l --list
1* select ename, hiredate from emp --select
SQL> / --run
ENAME HIREDATE
---------- --------
SMITH 80/12/17
ALLEN 81/02/20
WARD 81/02/22
JONES 81/04/02
MARTIN 81/09/28
BLAKE 81/05/01
CLARK 81/06/09
SCOTT 87/04/19
KING 81/11/17
TURNER 81/09/08
ADAMS 87/05/23
ENAME HIREDATE
---------- --------
JAMES 81/12/03
FORD 81/12/03
MILLER 82/01/23
14 개의 행이 선택되었습니다.
SQL> ed1 --Edit the file 1.sql
SQL> @1 --Execute the contents of the file 1.sql
ENAME
----------
SMITH
ALLEN
WARD
JONES
MARTIN
BLAKE
CLARK
SCOTT
KING
TURNER
ADAMS
ENAME
----------
JAMES
FORD
MILLER
14 개의 행이 선택되었습니다.
SQL> l
1* select ename from emp -- List the current buffer
SQL> save 2 --Save the current buffer to the file 2.sql
file 2.sql(이)가 생성되었습니다
SQL> ed1. --Edit the file 1.sql
SQL> ed2 --Edit the file 2.sql
SQL> host --Execute the host operating system command interpreter
Microsoft Windows [Version 10.0.19045.3570]
(c) Microsoft Corporation. All rights reserved.
C:\Users\Koreavc4>exit --Exit SQL*Plus
SQL> show user --Show the current user
USER은 "SCOTT"입니다
SQL> exit --Exit the host operating system command interpreter
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options에서 분리되었습니다.
C:\Users\Koreavc4>cd d:\ --Change to the D:\ drive
C:\Users\Koreavc4>cd.. --Change to the parent directory
C:\Users>d: --Change to the D:\ drive
d:\>c: --Change to the C:\ drive
C:\Users>cd C:\Users\Koreavc4 --Change to the C:\Users\Koreavc4 directory
C:\Users\Koreavc4>sqlplus scott/tiger --Connect to the SCOTT schema using the password TIGER
SQL*Plus: Release 11.2.0.1.0 Production on 수 10월 25 16:42:58 2023
Copyright (c) 1982, 2010, Oracle. All rights reserved.
다음에 접속됨:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> ed d:\3 --Edit the file D:\3.sql
SQL> show user
USER은 "SCOTT"입니다
SQL> select * from tab; --Select all tables from the user_tables view
TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
BONUS TABLE
DEPT TABLE
EMP TABLE
SALGRADE TABLE
SQL>
// 오늘의 숙제
// 조별 과제
// 우리조 주제
1. DBMS의 시장성 (점유율을 조사해서 그래프를 꼭 그려넣어라. 그래프 필수!)
2. Data Mining 데이터 분석 개념
// 프레젠테이션 조건
- 각 주제당 ppt 10장이내, 주제당 파일 따로 만들어야 함.
- 한 주제당 5분정도로 발표
- 11/1 (수) 점심먹기 전에 발표
- 발표자는 랜덤. 그날 선생님이 선택하심. 누가 발표할지 모르니까 개별로 다 준비할 것.
// 오라클 완전 삭제방법
'DataBase' 카테고리의 다른 글
<DataBase_231101수> 다중행 함수 (0) | 2023.11.01 |
---|---|
<DataBase_231031화> 단일행 함수 문제&답안 (2) | 2023.10.31 |
<DataBase_231030월> 단일행 함수 (0) | 2023.10.30 |
<DataBase_231027금> 테이블, DDL 제약조건 (2) | 2023.10.27 |
<DataBase_231026목> 연산자 정렬, 연산자 과제&답안 (2) | 2023.10.26 |