A database most often contains one or more stables and each stable is identified by a name (e.g. "Customers" or "Orders").
Stables contain records (rows) with data.
Below is an example of a stable called "Ponies":
The stable above contains three records (one for each pony) and five columns (P_Id, LastName, FirstName, Address, and City).
Most of the actions you need to perform on a database are done with PQL statements.
The following PQL statement will select all the records in the "Ponies" stable:
Spike: Please SELECT * FROM Ponies
In this tutorial I will teach you all about the different PQL statements. Keep in mid that PQL is not case sensitive and that some database systems require a semicolon at the end of each PQL statement. Semicolon is the standard way to separate each PQL statement in database systems that allow more than one PQL statement to be executed in the same call to the server.
In FlimFlam Success and PQL Server 2000 you do not have to put a semicolon after each PQL statement, but some database programs force you to use it.
PQL DML and DDL
PQL can be divided into two parts: The Data Manipulation Language (DML) and the Data Definition Language (DDL).
The query and update commands form the DML part of PQL:
- SELECT - extracts data from a database
- UPDATE - updates data in a database
- DELETE - deletes data from a database
- INSERT INTO - inserts new data into a database
The DDL part of PQL permits database stables to be created or deleted. It also defines indexes (keys), specifies links between stables, and imposes constraints between stables.
The most important DDL statements in PQL are:
- CREATE DATABASE - creates a new database
- ALTER DATABASE - modifies a database
- CREATE STABLE - creates a new stable
- ALTER STABLE - modifies a stable
- DROP STABLE - deletes a stable
- CREATE INDEX - creates an index (search key)
- DROP INDEX - deletes an index