MySQL Basics with PHP
MySQL Basics with PHP
Learn Essential MySQL in Just 99 Pages
About the Book
Download the Sample (Contains first 8 chapters)
This book walks you through the essential MySQL skills a programmer should have in just 90 pages. The topics were chosen based on my years of experience in MySQL related applications.
I have covered the most frequently used features of MySQL in this book and have a chapter on explaining the advanced features so that once you know the basics, you can go ahead mastering the advanced features.
About Me
I started my professional career about six years ago and have gained sound knowledge in PHP, MySQL and related technologies. I experienced learning challenges of these technologies earlier in my career and have seen how other beginners struggle.
As a way of sharing my knowledge and helping beginners, I launched PHPKnowHow.com in 2010.
About the Contents
If you are a MySQL beginner struggling to grasp the basics, this book is for you. You will learn creating and managing MySQL users, creating databases and tables, CRUD (Insert, Select, Update, Delete) operations, and Joins.
Additionally you will learn how to use MySQL in PHP with PHP's MySQL Improved Extension. If PHP is not your programming language, you would still find the book useful since PHP usage is only an addition to the book.
Why Should You Buy This Book Now?
If there would be any updates to this book, you will get all of them free plus you won't have to bear any price increases.
Bundles that include this book
Table of Contents
-
Preface
- About Me
- About the Book
- How to Provide Feedback
-
Chapter 1 - Introduction to MySQL
- MySQL History
- MySQL Infrastructure
- Installing MySQL
-
Chapter 2 - Using MySQL Command-line
- MySQL Path
- Logging into MySQL
- Executing Commands
- Command-line Pretty Output
- Multiple Line Commands
- How to Clear Command-line
- Logging out of MySQL
- Chapter 3 - MySQL GUI Tools
-
Chapter 4 - Managing MySQL Users
- Root User
- Changing Root Password
- Logging as a User
- Viewing Existing Users
- Creating a New User
- Granting Privileges to a User
- Changing a User Password
- Deleting a User
- Summary
-
Chapter 5 - PHP MySQL Connections
- MySQL Extension
- MySQL Improved (MySQLi) Extension
- PHP Data Objects (PDO)
- Which Method to Use?
-
Chapter 6 - MySQLi Procedural Functions
- mysqli_connect()
- mysqli_connect_error()
- mysqli_select_db()
- mysqli_close()
- mysqli_query()
- mysqli_fetch_array()
- mysqli_free_result()
- mysqli_num_rows()
- mysqli_affected_rows()
- mysqli_error()
- mysqli_real_escape_string()
-
Chapter 7 - MySQL Database Commands
- Show Databases
- Create Database
- Drop Database
- Use Database
- How to Check the Current Database
- How to Get Database Metadata
- How to Get Database Size
- How to Rename a Database
-
Chapter 8 - MySQL Table Commands
- How to Create a Table
- How to Retrieve the Table Definition of a Table
- How to List All Tables
- How to Delete a Table
- How to Rename a Table
- How to Copy a Table
- How to Change Table Schema
- How to Delete All the Records of a Table
- How to Get Table Size
- Foreign Key Constraints
-
Chapter 9 - MySQL Insert Statement
- Alternative Syntaxes
- Inserting Multiple Rows
- Handling Duplicates
- Inserting from Another Table
-
Chapter 10 - Using MySQL Insert Statement in PHP
- Inserting a Single Row
- Inserting Multiple Rows
- Escaping Values
-
Chapter 11 - MySQL Select Statement
- Selecting All the Columns from a Table
- Selecting Only a Set of Columns from a Table
- Filtering Rows with WHERE Clause
- Renaming Retrieved Columns
- Limiting the Number of Rows Returned
- Ordering the Rows Returned
- Eliminating Duplicate Rows
- Concatenating Result Columns
- Adding Custom Columns to Rows Returned
- Selecting Aggregated Data
- Grouping the Rows Returned
- Merging Result Sets with UNION Statement
- Retrieving Data from Multiple Tables
- Syntax of SELECT Statement
-
Chapter 12 - Using MySQL Select Statement in PHP
- Constructing WHERE IN()
-
Chapter 13 - MySQL Update Statement
- Updating Rows that Match Conditions
- Making Amendments to Existing Values
- Setting the Order of Update
- Limiting Number of Rows to Update
- Using MySQL Update Statement in PHP
-
Chapter 14 - MySQL Delete Statement
- Deleting All the Rows from a Table
- Deleting Rows That Match Conditions
- Preserving Auto-increment Counter
- Limiting Number of Rows to Delete
- Setting the Order of Deletion
- Using TRUNCATE TABLE Statement
- Differences Between DELETE FROM and TRUNCATE TABLE
- Using MySQL Delete Statement in PHP
-
Chapter 15 - MySQL Joins
- INNER JOIN
- LEFT JOIN
- RIGHT JOIN
- Cartesian Product
- Resolving Name Ambiguity
- Joining Multiple Tables
- One-to-many Relationships
- Using ORDER BY and LIMIT
- Specifying Multiple Relationships in ON Clause
- Swapping Column Names in ON Clause
- Chapter 16 - MySQL Many-to-many Relationships
-
Chapter 17 - MySQL Transactions
- Statements That Don’t Support Transactions
-
Chapter 18 - MySQL Backup and Restore
- How to Backup an Entire Database
- How to Backup Only Few Tables
- How to Ignore Few Tables
- How to Backup Only Table Schema and Ignore Data
- How to Restore a Database
-
Chapter 19 - Advanced MySQL Features
- Indexes
- Subqueries
- Views
- User Variables
- Prepared Statements
- Stored Procedures and Functions
- Triggers
- Scheduled Events
- Appendix A
Other books by this author
The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.
You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!
So, there's no reason not to click the Add to Cart button, is there?
See full terms...
Earn $8 on a $10 Purchase, and $16 on a $20 Purchase
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earnedover $14 millionwriting, publishing and selling on Leanpub.
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them