Any database can store data, but Oracle is designed to help us process data. Many applications treat the database as a glorified text file, and there are many opportunities to use the database engine to improve our programs.
Oracle SQL is a great programming language and has many advantages compared to other languages and SQL implementations.
- Declarative: Declarative languages let us tell the computer what we want, without having to specify how to do it. Declarative languages are different than traditional imperative languages and can be difficult at first. (Whenever we find ourselves wanting to use a loop in SQL, that’s a clue we’re thinking in the wrong programming paradigm.) Declarative languages let the compiler handle the details, leading to simpler and faster code. But if we need to control exactly how our code runs, we still have imperative options, such as PL/SQL, hints, and the MODEL clause.
- Popular: Oracle is one of the most popular databases in the world. And SQL is one of the most popular programming languages in the world.
- Portable: SQL and PL/SQL are entirely platform independent. Other than a rare bug, we never need to worry about which operating system is running our SQL.
- Clear and concise: The basic syntax is simple and readable, and the relational model is built on a few simple ideas. (If this description doesn’t match your reality, Part III will explain how to make your code look better.)
- Interpreted: Statements run immediately, without a separate compilation step. Integrated development environments can take advantage of interpreted languages and let us instantly run programs, debug our code, and get results.
- Powerful: Oracle SQL has enough features to solve almost any problem. For those rare exceptions, PL/SQL can handle them and integrate perfectly with SQL.
- Fast: Oracle SQL is powerful enough to let us bring algorithms to our data, instead of bringing data to our algorithms. Ignore those shallow benchmarks that compare running
SELECT COUNT(*) FROM EMPLOYEEa thousand times. Real-world performance is more complicated than that and depends more on an optimizer than the speed of running trivial commands.
Despite all those advantages, Oracle SQL is scandalously under-used. There are huge opportunities to improve our systems by using SQL more often.