SlideShare a Scribd company logo
1 of 15
Download to read offline
제 11장 뷰
이 상덕
1. 뷰의 개념과 뷰 사용하기
2. 다양한 뷰 옵션
3. 예제
CONTENTS
1. 뷰의 개념과 뷰 사용하기(1)
뷰의 목적
(1) 보안 관리를 목적으로 활용한다. (보안성)
(2) 사용상의 편의를 목적으로 활용한다. (편의성)
(3) 수행속도의 향상의 목적으로 활용한다. (속도 향상)
(4) 융통성의 향상시킬 목적으로 활용한다. (융통성)
(5) SQL의 성능을 향상시킬 목적으로 활용한다. (활용성)
(6) 임시적인 작업을 위해 활용한다. (임시성)
1. 뷰의 개념과 뷰 사용하기(2) – 뷰 생성
-문법
CREATE OR REPLACE [FORCE | NOFORCE{기본옵션}]
VIEW 뷰이름(칼럼명 순차적 정의)
AS SUBQUERY
[WITH CHECK OPTION]
[WITH READ ONLY];
-뷰의 종류(단순 뷰(테이블1개), 복합 뷰(테이블 2개이상))
1. 뷰의 개념과 뷰 사용하기(3) - 예시(단순뷰_1)
1. 뷰의 개념과 뷰 사용하기(4) - 예시(단순뷰_2)
1. 뷰의 개념과 뷰 사용하기(5) - 예시(복합뷰_1)
1. 뷰의 개념과 뷰 사용하기(6) - 예시(복합뷰_2)
1. 뷰의 개념과 뷰 사용하기(7) – 보안 관련 문제
-구조와 데이터를 복사한 사원 테이블에서 커미션이나
급여를 제외한 뷰 만들기(뷰이름: EMP_GEN_VW).
-뷰의 데이터를 수정이나 삭제하여 기본 테이블에도 결
과가 반영되는지 볼 것.
2. 다양한 뷰 옵션(1) - FORCE
문법
CREATE OR REPLACE
FORCE
VIEW 뷰이름(칼럼명[1]…. 칼럼명[N]) AS SUBQUERY
문제) 뷰(이름: TABLES_VW)를 생성하고, FORCE 옵션을 사용
해 생성되지 않은 테이블(이름:NOTABLES)을 참조하세요.
[테이블은 생성하지 않음. 이름만 사용].
2. 다양한 뷰 옵션(2) – WITH CHECK OPTION
문법
CREATE OR REPLACE VIEW 뷰이름(칼럼명[1]…. 칼럼명[N])
AS
SELECT
FROM
WHERE 조건
WITH CHECK OPTION
문제) EMPS 테이블을 사용하여, 100~200번 사원의 정보
만 볼 수 있는 뷰를 만드세요[WITH CHECK OPTION 적용].
그리고, 100번과 201번 사원의 정보를 만들어서 각각 넣어
보세요.(뷰이름: EMP_INFO_VW)
2. 다양한 뷰 옵션(3) – WITH READ ONLY[읽기전용]
- 사원테이블에서 직무별 대표(REP)만 볼 수 있는 뷰(이름:
EMP_JOBID_VW)를 만들면서 WITH READ ONLY 옵션 적
용.
- 뷰(EMP_JOBID_VW)에 세일즈 대표(SA_REP)를 추가하기.
2. 다양한 뷰 옵션(4) – 삭제[문법과 문제]
문법
DROP VIEW 뷰이름 CASCADE CONSTRAINTS;
문제) 기존에 설정한 뷰를 삭제하기
3. 예제
1. 부서코드가 80 번인 사원들만 출력하는 뷰를 만드세요.
읽기전용 옵션 적용(뷰이름: EMP_DEPTID80_VW)
2. 기본 테이블이 없는 뷰를 생성해보세요.
3. 1번에서 생성한 뷰에 WITH CHECK OPTION 옵션을
추가하고, 부서코드가 70 번인 사원의 정보를 추가해보세요.
4. 1번에서 생성한 뷰에 WITH READ ONLY 옵션을 추가하고,
사원 정보를 추가해보세요.
5. USER_VIEWS로 뷰에 대한 정보를 조회해보세요.
THANKS FOR EVERYTHING
Q&A

More Related Content

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

제11장 뷰

  • 2. 1. 뷰의 개념과 뷰 사용하기 2. 다양한 뷰 옵션 3. 예제 CONTENTS
  • 3. 1. 뷰의 개념과 뷰 사용하기(1) 뷰의 목적 (1) 보안 관리를 목적으로 활용한다. (보안성) (2) 사용상의 편의를 목적으로 활용한다. (편의성) (3) 수행속도의 향상의 목적으로 활용한다. (속도 향상) (4) 융통성의 향상시킬 목적으로 활용한다. (융통성) (5) SQL의 성능을 향상시킬 목적으로 활용한다. (활용성) (6) 임시적인 작업을 위해 활용한다. (임시성)
  • 4. 1. 뷰의 개념과 뷰 사용하기(2) – 뷰 생성 -문법 CREATE OR REPLACE [FORCE | NOFORCE{기본옵션}] VIEW 뷰이름(칼럼명 순차적 정의) AS SUBQUERY [WITH CHECK OPTION] [WITH READ ONLY]; -뷰의 종류(단순 뷰(테이블1개), 복합 뷰(테이블 2개이상))
  • 5. 1. 뷰의 개념과 뷰 사용하기(3) - 예시(단순뷰_1)
  • 6. 1. 뷰의 개념과 뷰 사용하기(4) - 예시(단순뷰_2)
  • 7. 1. 뷰의 개념과 뷰 사용하기(5) - 예시(복합뷰_1)
  • 8. 1. 뷰의 개념과 뷰 사용하기(6) - 예시(복합뷰_2)
  • 9. 1. 뷰의 개념과 뷰 사용하기(7) – 보안 관련 문제 -구조와 데이터를 복사한 사원 테이블에서 커미션이나 급여를 제외한 뷰 만들기(뷰이름: EMP_GEN_VW). -뷰의 데이터를 수정이나 삭제하여 기본 테이블에도 결 과가 반영되는지 볼 것.
  • 10. 2. 다양한 뷰 옵션(1) - FORCE 문법 CREATE OR REPLACE FORCE VIEW 뷰이름(칼럼명[1]…. 칼럼명[N]) AS SUBQUERY 문제) 뷰(이름: TABLES_VW)를 생성하고, FORCE 옵션을 사용 해 생성되지 않은 테이블(이름:NOTABLES)을 참조하세요. [테이블은 생성하지 않음. 이름만 사용].
  • 11. 2. 다양한 뷰 옵션(2) – WITH CHECK OPTION 문법 CREATE OR REPLACE VIEW 뷰이름(칼럼명[1]…. 칼럼명[N]) AS SELECT FROM WHERE 조건 WITH CHECK OPTION 문제) EMPS 테이블을 사용하여, 100~200번 사원의 정보 만 볼 수 있는 뷰를 만드세요[WITH CHECK OPTION 적용]. 그리고, 100번과 201번 사원의 정보를 만들어서 각각 넣어 보세요.(뷰이름: EMP_INFO_VW)
  • 12. 2. 다양한 뷰 옵션(3) – WITH READ ONLY[읽기전용] - 사원테이블에서 직무별 대표(REP)만 볼 수 있는 뷰(이름: EMP_JOBID_VW)를 만들면서 WITH READ ONLY 옵션 적 용. - 뷰(EMP_JOBID_VW)에 세일즈 대표(SA_REP)를 추가하기.
  • 13. 2. 다양한 뷰 옵션(4) – 삭제[문법과 문제] 문법 DROP VIEW 뷰이름 CASCADE CONSTRAINTS; 문제) 기존에 설정한 뷰를 삭제하기
  • 14. 3. 예제 1. 부서코드가 80 번인 사원들만 출력하는 뷰를 만드세요. 읽기전용 옵션 적용(뷰이름: EMP_DEPTID80_VW) 2. 기본 테이블이 없는 뷰를 생성해보세요. 3. 1번에서 생성한 뷰에 WITH CHECK OPTION 옵션을 추가하고, 부서코드가 70 번인 사원의 정보를 추가해보세요. 4. 1번에서 생성한 뷰에 WITH READ ONLY 옵션을 추가하고, 사원 정보를 추가해보세요. 5. USER_VIEWS로 뷰에 대한 정보를 조회해보세요.