Chapter 26. Views

26.1 Introduction

MySQL supports two types of tables: real tables, generally known as base tables, and derived tables, also called views. Base tables are created with CREATE TABLE statements and are the only ones in which data can be stored. Examples are the PLAYERS and TEAMS tables from the tennis club database.

A derived table, or view, stores no rows itself. Instead, it serves as a prescription or formula for combining certain data from base tables to make a “virtual” table. The word virtual is used because the contents of a view exist only when it is used in a statement. At that moment, MySQL retrieves the prescription that makes up the view formula, executes it, and presents the user with what seems to be a real table. ...

Get SQL for MySQL Developers: A Comprehensive Tutorial and Reference 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.