Skip to Content
Head First SQL (Korean Edition), 2nd Edition
book

Head First SQL (Korean Edition), 2nd Edition

by Kimberly Fessel
June 2026
740 pages
14h 34m
Korean
O'Reilly Media, Inc.
Content preview from Head First SQL (Korean Edition), 2nd Edition

제13장. 함수와 저장 프로시저: 재사용 가능한 코드

이 작품은 AI를 사용하여 번역되었습니다. 여러분의 피드백과 의견을 환영합니다: translation-feedback@oreilly.com

Image

코드를 버리지 말고 재사용하세요. 거의 비슷한 코드를 반복해서 다시 입력하는 일은 금세 지루해질 뿐만 아니라 불필요한 낭비처럼 느껴집니다. 지속 가능한 사고방식을 받아들일 준비가 되었다면, 이 장에서는 SQL 명령어를 저장하고 하는 방법을 알려드립니다. 함수 는 완전히 새로운 입력값에 대해 미리 저장된 일련의 계산을 수행하는 지름길을 제공합니다. 함수는 계산된 결과를 반환하며, 이 결과를 새로운 값 열로 SELECT하여 가져올 수도 있습니다. 얼마나 친환경적이면서도 세련된 방법인가요! 하지만 함수가 아무리 훌륭하더라도 만능 해결책은 아닙니다. 테이블 데이터를 수정하거나 다른 복잡한 작업을 수행하려면 직접 저장 프로시저를 를 직접 작성해야 합니다. 이러한 매개변수와 변수 는 저절로 재활용되지 않으니, 다음 페이지를 넘겨 시작해 보세요.

반복되는 작업...

SQL 코드를 작성하는 것은 재미있지만, 사소한 수정만 가한 거의 똑같은 SQL 코드를 반복해서 작성하다 보면 지칠 수 있습니다. 애비는 다양한 기상 조건을 가진 장소를 찾던 중 이 문제에 정면으로 부딪힌 것 같습니다.

Image
Image
Image

함수를 활용하여 코드를 재사용하세요

코드를 복사하고 붙여넣은 뒤 약간만 수정하는 일이 잦다면, 함수가 필요할 가능성이 높습니다. 함수 을 사용하면 코드를 한 번만 작성하고 그 코드를 원하는 만큼 재사용할 수 있게 해줍니다. 함수는 종종 매개변수라고 불리는 사용자 입력을 받아, 전달된 값에 따라 동작을 변경합니다.

이 말이 꽤 생소하게 들릴 수도 있지만, 사실 여러분은 이미 여러 가지 내장 SQL 함수를 사용해 본 적이 있습니다. 이제 “함수를 찾아보세요!” 시간입니다.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Tips for Designing Effective Presentation Slide Decks

Tips for Designing Effective Presentation Slide Decks

Curtis Newbold
What Successful Project Managers Do

What Successful Project Managers Do

W. Scott Cameron, Jeffrey S. Russell, Edward J. Hoffman, Alexander Laufer
How to Overcome a Power Deficit

How to Overcome a Power Deficit

Cyril Bouquet, Jean-Louis Barsoux
Relational Power Is the New Currency of Hybrid Work

Relational Power Is the New Currency of Hybrid Work

Lebene Soga, Yemisi Bolade-Ogunfodun, Nazrul Islam, Joseph Amankwah-Amoah

Publisher Resources

ISBN: 0642572408091