How Work with White Space and Semicolons in Simple SQL Selects

  • google plus

In Brief...

You must use at least one white space character between each keyword, table or column name in an SQL select. In addition, a semicolon is required as the statement delimiter.

Take our Introduction to SQL Training course for free.

See the Course Outline and Register

Instructions

To learn how to add comments in simple SQL select statements, follow these steps:

  1. You'll need to setup the MySQL database tables. The instructions for the setup can be found in How to add comments in simple SQL selects. Follow steps 1 through 7 in this topic before proceeding to the next step.
  2. Your database is ready for action! Now we'll explore white space and semicolons in simple select statement.
  3. When you type in an SQL select statement you must use the semicolon to indicate the end of the statement:
    Semicolon example
    When MySQL encounters the semicolon, the SQL statement will be executed.
  4. You must place at least one white space as a separator between the keywords, table names and column names on an SQL select. Arbitrarily many spaces can be used as separators:
    White space example
    One white space between each select keyword, table or column name is sufficient. An excessive number of white space can hinder the readability of your statement.

Webucator provides instructor-led training to students throughout the US and Canada. We have trained over 90,000 students from over 16,000 organizations on technologies such as Microsoft ASP.NET, Microsoft Office, XML, Windows, Java, Adobe, HTML5, JavaScript, Angular, and much more. Check out our complete course catalog.

Categories

Courses

Author: Stephen Withrow

Stephen has over 30 years' experience in training, development, and consulting in a variety of technology areas including Java, C, C++, XML, JavaScript, AJAX, Tomcat, JBoss, Oracle, and DB2. His background includes design and implementation of business solutions on client/server, Web, and enterprise platforms. Stephen is a published writer in both technical and non-technical endeavors. Stephen received an undergraduate degree in Computer Science and Physics from Florida State University.

Discuss