Home SQL PHP HTML Perl PowerBuilder C/C++ General Solutions Contacts

SQL

Index
Search and Replace
Multiple Outer Joins
Comparing Dates

Procedures

Template

SQL

Structured Query Language


A bit about SQL

SQL is probably the most essential language for client/server or web development, it is the most common language used to obtain information from databases. This section deals with SQL-92, and also Transact SQL (T-SQL) extensions for Sybase ASE and Microsoft SQL Server.

Common Terminology

  • SQL - Structured Query Language (sometimes also incorrectly referred to as Standardized Query Language)
  • db - Database, a collection of data stored on a computer system.
  • DBMS - Database Management System, allows you to store, modify, and extract information from a database.
  • T-SQL - Transact SQL, an extension to the SQL language providing transaction handling and stored procedures amongst other benefits. Developed by Sybase, but later used by Microsoft, there are differences in the T-SQL of the 2 systems but they're fairly compatible.

Which SQL?

There are many variants of SQL, however, the majority of DBMS are currently based on the ANSI SQL-92 standards. SQL-92 is generally the best place to start learning, because this is what most people use. Things become slightly more complicated when / if you delve into stored procedures (compiled SQL procedures) because each DBMS has its own syntax. Generally speaking stored procedures have a similar structure across each DBMS, they deal with errors and transaction handling with different syntax. Stored procedures are, generally speaking, incompatible across the different DBMS.

Stored Procedures

Whilst stored procedures are generally incompatible across each DBMS, they do serve some very useful purposes. One of the major advantages being efficiency, a well written stored procedure is much faster than an uncompiled set of SQL statements. The other major advantage, especially for those without application servers, is that the code can be reused across applications minimizing the amount of code that needs to be fixed in the event of a bug or upgrade.

It is useful to have a standard template for your stored procedures, I've supplied a fairly basic one here, feel free to modify it for your own needs.

Database Management Systems

This is Code, all contents copyright - © Wayne Jones 2004.