17 Saving Time with Views, Functions, and Triggers

One advantage of using a programming language is that we can automate repetitive, boring tasks. That’s what this chapter is about: taking the queries or steps you might do over and over and turning them into reusable database objects that you code once and can call later to let the database do the work. Programmers call this the DRY principle: Don’t Repeat Yourself.

You’ll start by learning to store queries as reusable database views. Next, you’ll explore how to create database functions you can use to operate on your data, the same way you’ve used built-in functions like round() and upper() ...

Get Practical SQL, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.