SQL comments

Before you start diving into the world of SQL, just a short note about commenting your SQL code. In SQL, there are a number of ways to comment your code, of which the most popular are /* */ and #, both of which are seen in PHP. Of the two, # is more popular - like PHP, it comments to the end of the line.

Author's Note: I personally find # good for SQL because I never use it in PHP scripts - it makes the distinct between complex SQL queries and PHP code that little bit more obvious. Choose what fits you best.


Want to learn PHP 7?

Hacking with PHP has been fully updated for PHP 7, and is now available as a downloadable PDF. Get over 1200 pages of hands-on PHP learning today!

If this was helpful, please take a moment to tell others about Hacking with PHP by tweeting about it!

Next chapter: Interacting with MySQL >>

Previous chapter: SQL

Jump to:


Home: Table of Contents

Copyright ©2015 Paul Hudson. Follow me: @twostraws.