An SQL 'query' (a command or series of related commands) is passed to the database
engine which processes the instructions it contains. Any results are then returned the querier.
An SQL query may be as simple as retrieving one record from the database, or as complex as
multi-step filtering of data based on multi-level criteria. Efficient use of SQL can help
to save bandwidth, time and processor usage in complex situations.
What is it?
SQL is, at its heart, a programming language. An SQL 'query' manifests itself as a series
of commands or statements; queries can include arithmetic calculations and can use query elements
or procedures stored in the system. SQL databases are designed from the start using SQL queries –
these designs (or 'schema') can be very complicated, and the proper design of complex examples is a
specialist area in itself.
The SQL language is used to ask the database questions about the data stored inside: “what is the
value of the element stored in this index?”, or “what is the relationship between these sets of data?”.
Manipulative commands, such as “Please insert this data” or “please update this record as follows” are
also issued using SQL queries (properly the commands which actually alter the stored data are referred
to as the Data Manipulation Language (DML)). A Data Definition Language (DDL) allows SQL queries to
create and administer the data structures, the 'tables' of data, that constitute the database. The
actual syntax used is a little more strict and regimented than these natural language phrases suggest,
but in effect this is the type of communication that will take place between a relational database and
the person or device querying it using SQL.
SQL is standardised by ANSI (American National Standards Institute), but many dialects exist and
while the principles remain largely the same between different implementations, some of the detail does differ
Uses
There are many differing ways in which databases can be created and used, and SQL is just one way of
them. Its standardisation, though, as well as the omnipresence it enjoys throughout the computing industry
means that it is the natural choice for most users and applications. Popular dialects of SQL are used in,
amongst others, Microsoft applications (Microsoft Access), the widely used Oracle database system, and
MySQL (a very widely adopted free implementation). For SQL queries to be used on a database, it must
be formatted to be compatible, and this must be done from inception. Retrospectively changing a data
storage engine to be compatible is simply not practical.
Database servers are commonly used with web applications, large-scale database-driven
websites, web applications, large intranets and many other examples of enterprise-level 'distributed computing'.
Widespread take-up is assisted and encouraged by the compatibility of many existing programming languages
with different SQL implementations.
How Can It Help Businesses?
A properly designed and maintained database is essential for the use or manipulation any
non-trivial data collection. Whether the database manifests itself as an alphanumerically ordered
filing cabinet, a spreadsheet, or a fully fledged relational SQL database on a dedicated server,
the information needs to be ordered in a sensible manner.
Depending on the implementation used, SQL offers excellent protection to data. Integrity of data can
be maintained, duplicates easily identified and removed, and simultaneous access and updates to the
same record can be safely administered and recovered from, where necessary. The speed at which the
implementation will run depends on the way in which the SQL database is set up from the outset and
upon the efficiency of the SQL statements used, but in all cases it is likely to improve upon manual
and custom-made solutions such as spreadsheets (and the filing cabinets discussed earlier).
SQL is so frequently used in the industry that it represents a natural choice for many organisations:
it may be possible to integrate much of an company's existing software applications with an SQL
implementation, and clearly this is of great financial benefit. Coupling this with the large number
of freely available resources and help materials, tools, and the shallow
learning curve required in
the initial learning steps, means that SQL often represents and natural choice.
|