About SQL

Description

The language that you use to talk to an AlphaDAO back-end database is SQL. The two most common types of SQL commands that you will want to send to your database are commands that returns a set of records (do not confuse the use of the word "set" here with Alpha Anywhere's Set object) and commands that update, delete, or insert records into the database.

There are many other types of SQL commands that you could send to the database (such as commands to create new tables and indexes), but we are not going to cover these in this document. SQL commands that return a set of records start with the SELECT keyword. For example:

SELECT * FROM customer
SELECT customer_id, firstname, lastname FROM customer WHERE bill_state_region = 'ma' ORDER BY lastname

The WHERE clause of the second statement is equivalent to a filter expression used in an Alpha Anywhere table query. The ORDER BY clause is equivalent to the Alpha Anywhere order expression.

A Quick Note About SQL 

On the surface, SQL is a standardized language, but unfortunately, each back-end database uses slightly different syntax and conventions. For example, in Microsoft Access and SQL Server, field and table names containing spaces are enclosed in square brackets ( first name ). In Oracle, they are double quoted ( "first name" ), and in MySQL they are quoted using a special character ( 'first name' ). To solve this problem, AlphaDAO supports a database independent version of SQL named Portable SQL. AlphaDAO invisibly translates Portable SQL Syntax to your database's native SQL syntax. Even if you find yourself interacting with more than one data source, such as Oracle, Access, and Excel, you will only have to learn one SQL dialect. Having said this, if you want to write in the native SQL of any supported database, you are free to do so.

See Also