Quackit Logo
Sponsored Links
$1.99 Domain Names
With every new non-domain purchase thru ZappyHost, you get a domain name for only $1.99.
Create free Flash websites

SQL Syntax

Print Version

The SQL syntax is quite an easy one to grasp. Most of the actions you need to perform are done with a SQL statement.

Generally, a SQL statement begins by stating what to do (for example, "SELECT"), then states which object to do it to (for example, using the "FROM" clause).

SELECT * FROM Individual

It may also have a condition added to the end (for example, with a WHERE clause).

SELECT * FROM Individual
WHERE FirstName = 'Homer'

SQL is not case sensitive - the above examples could just have easily used all lowercase or all uppercase. Different programmers have their own preferences. For readability purposes, many SQL programmers prefer to use uppercase for SQL commands and lowercase for everything else.

The SQL syntax allows you to include line breaks at logical points without it breaking the statement. For example, the above example could have been written all on one line - or across 4 lines.

Also, some database systems require that you use a semicolon at the end of each SQL statement (although this tutorial doesn't use the semicolon).

DML & DDL

SQL is divided into two main categories; Data Manipulation Language (DML), and Data Definition Language (DDL). An explanation follows.

Data Manipulation Language (DML)

DML enables you to work with the data that goes into the database. DML is used to insert, select, update, and delete records in the database. Many of your SQL statements will begin with one of the following commands:

  • SELECT - Retrieves data from the database
  • INSERT - Inserts new data into the database
  • UPDATE - Updates existing data in the database
  • DELETE - Deletes existing data from the database

Data Definition Language (DDL)

You may also occasionally need to create or drop a table or other datbase object. SQL enables you to do this programatically using DDL.

Examples of DDL commands:

  • CREATE DATABASE - Creates a new database
  • ALTER DATABASE - Modifies the database
  • DROP DATABASE - Drops (deletes) a database
  • CREATE TABLE - Creates a new table
  • ALTER TABLE - Modifies the table
  • DROP TABLE - Drops (deletes) a table

These are just some of the object classes that can be defined using DDL. As you can probably guess, the syntax is generally the same for any object, although, each object will have properties specific to that object class.

As you can see, the SQL syntax is quite simple. It is also very powerful syntax - you can do a lot of damage with one line of code!

Enjoy this website?

  1. Add this page to your Favorites
  2. Link to this page (copy/paste into your own website or blog):
  3. Help support Quackit by making a donation
  4. Add this page to your favorite social bookmarks sites:      

Oh, and thank you for supporting Quackit!

FREE Hosting!
With every domain you register with ZappyHost you get FREE hosting.
Need Website Content?
Get unique, quality digital content for your website.
  • 270+ Website Templates
  • 800+ Flash Templates
  • 25,000+ Images, Logos
  • 30,000+ e-Books
  • 15,000+ Scripts
  • 27,000+ Animated GIFs
  • 21,000+ Ringtones
  • ...and much more!
Get your content now!
© Copyright 2000 - 2010 Quackit.com