SQL Newbie

SQL Tutorial

SQL (Structured Query Language) is the language that PowerBuilder uses to talk to all of the popular RDBMSs, e.g. Oracle, Sybase, Informix, DB2, MS SQLServer, SQL Anywhere etc. Though the DataWindow in PowerBuilder generates the SQL necessary for most routine things, you need to understand the underlying logic. SQL is a standard query language that can be used to enter, query, and change data in a database. SQL is also used to create and administer databases. Though each RDBMS has some variations on the basic SQL, we will cover common syntax here, by taking an example.

I strongly suggest that you create these two tables in the Examples database itself (from the database painter) and run these queries from the Database Administration in the database painter. This will give you a hands-on feel for SQL, which you can never get just by reading.

Let us say we have two tables 'Players' and 'Teams' as follows:

Players
Nbr Name Average Team
1 Baerga, C. .322 T1
2 Lofton, K. .322 T1
3 Belle, A. .311 T1
4 Thome, J. .330 T1
5 Ramirez, M. .330 T1
6 ONeill, P. .222 T2
7 Mattingly, D. .233 T2
8 Boggs, W. .255 T2
9 Bonds, B. .303 T3
10 Williams, M. .277 T3
11 Santiago, C. .111 T3
Teams
Team City Name
T1 Cleveland Indians
T2 New York Yankees
T3 San Francisco Giants

[Top] [Tables]

Sample SQL Queries (The query itself is in italics. Type upto and including the semi colon.):

[Top] [Tables]

[Top] [Tables]

[Top] [Tables]

This example courtesy of UWEC.

Number of hits since 10/01/96:


This web site is maintained by
Ashok Ramachandran
Revised: December 30, 1998