Beginning SQL

Standart Query Language (SQL) is the standart language for relational database management systems. SQL allows you to create, update or retrieve data from a database. There are plenty of relational database management systems such as Oracle, Microsoft SQL Server, Access, Sybase etc. Even though these systems are using SQL to communicate, they have their own functions and extensions. However, there are standart SQL commands that are same in all relational database management systems.

Some of the common commands are “SELECT”,  “INSERT”,  “UPDATE”,  “SET”, “CREATE” and “DROP”


The date for databases are stored on tables including columns and rows. Columns have name, data type and other attributes such as length of characters. Rows include the data related to the columns. Here is an example of a table named “Highest Towns”.

Rank, Country, City, Height are the colums. Here are rows contain data for the table:

Highest Towns
RankCountryCityHeight (m)Height (ft)
1PeruLa Rinconada5,10016,728
3ArgentinaEl Aguilar4,89516,062



In order to select data, create or alter the tables, you will need to run some queries.

Select Statement

Select statement allows you to retrieve the data which is based on the criteria you defined. Here is general format for select statement:
SELECT "Column1", "Column2" 
FROM "Table1"
WHERE "Condition1"

For the column name you can pick any columns you like. If you would like to have all the columns you can use “*” to select all columns in a given table.

FROM is used to specify the table name which its column names are selected in the beginning of the statement.

WHERE is the optional statement to define criterias for the selection of the data.


WHERE Clause

Following conditional operators can be used for WHERE clause:

>Greater than
<Less than
>=Greater than or equal
<=Less than or equal
<>Not equal to
LIKESpecify wild cards

LIKE in WHERE clause

Here are some examples of like used in where statement:

This statement searches for rows where the first name column is exaclty “John”

This statement searches for rows where the last name column includes “Ree” phrase any where in between.

Share this Post


Featured Author