The Syntax of SQL Statements - SQL Bootcamp: Learn the Basics of SQL Programming in 2 Weeks (2016)

SQL Bootcamp: Learn the Basics of SQL Programming in 2 Weeks (2016)

Chapter 3. The Syntax of SQL Statements

The SQL language uses a distinct collection of rules known as“syntax.” This chapter will teach you the basic syntax used in SQL. Study this material carefully since it will help you master this computer language in just 2 weeks.

Each SQL command begins with one of the following keywords: USE, DROP, SHOW, ALTER, UPDATE, INSERT, SELECT, DELETE, or CREATE. Additionally, each command ends with a semicolon.

You should know that SQL statements are not case sensitive. That means DELETE and delete are identical when it comes to SQL commands. If you are using MySQL, however, you should enter names as they appear on the database.

The Syntax of Basic SQL Commands

The SELECT Statement

This statement has the following clauses:

o The DISTINCT Clause -

o The WHERE Clause -

o The AND/OR Clause -

o The IN Clause–

o The BETWEEN Clause–

o The LIKE Clause–

o The ORDER BY Clause–

o The GROUP BY Clause–

o The COUNT Clause–

o The HAVING Clause–

The CREATE TABLE Command

The DROP TABLE Command

The CREATE INDEX Command

The DROP INDEX Command

The DESC Command

The TRUNCATE TABLE Command

The ALTER TABLE Command

The ALTER TABLE Command (for renaming tables)

The INSERT INTO Command

The UPDATE Command

The DELETE Command

The CREATE DATABASE Command

The DROP Database Command

The USE Command

The COMMIT Command

The ROLLBACK Command