• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 4. Using SQL > SQL Syntax

SQL Syntax

Although Dreamweaver insulates you from having to know a lot about SQL syntax, it’s useful to have an idea of what’s going on behind the scenes, and it’s necessary to know the very basics to create a database.

It’s possible to access and manipulate your database by opening a terminal window and sending commands directly to the server (Figure 4.4). But usually that’s not necessary, because you can use Dreamweaver dialog boxes to perform the most common tasks. You can, however, type some SQL commands directly into Dreamweaver’s Recordset definition window. We cover how to do that in the SELECT Statement section below.

Figure 4.4. You can type commands directly to a SQL database in a terminal window.


As we mentioned in the Chapter 3 section Creating a Database, SQL commands are terminated with a semicolon. The semicolon tells the server that a command is finished. So SHOW DATABASES; will show you a list of databases, whereas SHOW DATABASES will not.

Another important thing to remember is that SQL syntax uses an unfortunate mix of case sensitivity and case insensitivity that can get very confusing. In general, SQL command words are case insensitive. So select, Select, and SELECT are all the same. But database names, table names, and field names are case sensitive, so customer, Customer, and CUSTOMER signify three different things. Traditionally, SQL commands are typed in upper case, but you can use any mix of upper and lower case you prefer for table, database, and field names (although the code tends to be more readable if you use at least some lowercase).

Tip

  • Depending on the type of operating system you’re running, some SQL elements may not be case sensitive, but don’t count on it. To be on the safe side, treat all table names, field names, and aliases as case sensitive.


If you’re working with an existing database, you’ll be spending most of your time with three basic SQL commands: SELECT, INSERT, and UPDATE. The latter two deal primarily with adding and changing data in your database. They’re covered more extensively in Chapter 8. The first command, SELECT, constitutes the meat of this Chapter.

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint