SQL alone can ask a database “what” to do, but it can’t easily tell it “how” to do it step by step. In this chapter we’ll learn to write small programs that live inside the database, combining SQL with variables, loops, and decisions. By the end, you’ll be able to bundle business logic into reusable routines that run right next to your data.