LESSON 21Using SQL to Generate SQL Statements

In this lesson, you learn the concepts behind generating one or more SQL statements from a query. By the end of this lesson you should understand the following:

• The benefits of generating SQL statements from a query

• How to make the output from a query appear in the form of another SQL statement

• How to use the data dictionary, database tables, or both to form SQL statements

Understanding the Power of SQL Statement Generation

Generating SQL from another SQL statement simply means writing a SQL statement whose output forms another SQL statement or command. Until now, all the SQL statements that you have learned to write either do something, such as manipulate the data in a table one row at a ...

Get Sams Teach Yourself SQL in One Hour a Day, Fifth 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.