Database Reference
In-Depth Information
terisk to select all of the columns, but named the specific ones we want. We also chose
columns from two tables.
On the second line, we say to select these columns listed from books and from
status_names . The JOIN clause is where we named the second table.
In the WHERE clause,on the third line, we tell MySQL to match the values of the
status column from books to the values of the status_id column from the
status_names table. This is the point in which the rows from each will be joined. If
the idea of joining tables seems difficult, don't worry about it at this point. I've included it
just to show you what can be done with MySQL and MariaDB. I'll explain joins more
fully later.
When we created books , we could have made status a text or character field and
entered the words Active or Inactive for each row. But if you have a table with thousands
or maybe millions of rows of data, entering 0 or 1 is much easier and you're less likely to
make typos (e.g., you might enter Actve sometimes). Databases are tedious, but creating
tables with better structures and using better written SQL statements makes them less tedi-
ous and helps you to leverage your time andresources.
Search WWH ::




Custom Search