MySQL Basics
A database is a structured collection of records or data stored in a computer system and organized in such a way that it can be quickly searched and information can be rapidly retrieved.
The SQL in MySQL stands for Structured Query Language. This language is loosely based on English and is also used on other databases such as Oracle and Microsoft SQL Server. It is designed to allow simple requests from a database via commands such as:
SELECT title FROM publications WHERE author = 'Charles Dickens';
A MySQL database contains one or more tables, each of which contain records or rows. Within these rows are various columns or fields that contain the data itself. Table 8-1 shows the contents of an example database of five publications detailing the author, title, type, and year of publication.
Author | Title | Type | Year |
Mark Twain | The Adventures of Tom Sawyer | Fiction | 1876 |
Jane Austen | Pride and Prejudice | Fiction | 1811 |
Charles Darwin | The Origin of Species | Non-fiction | 1856 |
Charles Dickens | The Old Curiosity Shop | Fiction | 1841 |
William Shakespeare | Romeo and Juliet | Play | 1594 |
Each row in the table is the same as a row in a MySQL table, and each element within a row is the same as a MySQL field.
To uniquely identify this database, I’ll refer to it as the publications database in the examples that follow. And, as you will have observed, all these publications are considered to be classics of literature, so I’ll call the table within the database that holds the details classics ...
Get Learning PHP, MySQL, and JavaScript 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.