From http://www.w3schools.com (Copyright Refsnes Data)
SQL is a standard computer language for accessing and manipulating databases. |
The Structured Query Language (SQL) is the standard language for accessing databases such as SQL Server, Oracle, MySQL, Sybase, and Access.
Knowledge of SQL is invaluable for anyone wanting to store or retrieve data from a database.
SQL is an ANSI (American National Standards Institute) standard computer language for accessing and manipulating database systems. SQL statements are used to retrieve and update data in a database. SQL works with database programs like MS Access, DB2, Informix, MS SQL Server, Oracle, Sybase, etc.
Unfortunately, there are many different versions of the SQL language, but to be in compliance with the ANSI standard, they must support the same major keywords in a similar manner (such as SELECT, UPDATE, DELETE, INSERT, WHERE, and others).
Note: Most of the SQL database programs also have their own proprietary extensions in addition to the SQL standard!
A database most often contains one or more tables. Each table is identified by a name (e.g. "Customers" or "Orders"). Tables contain records (rows) with data.
Below is an example of a table called "Persons":
LastName | FirstName | Address | City |
---|---|---|---|
Hansen | Ola | Timoteivn 10 | Sandnes |
Svendson | Tove | Borgvn 23 | Sandnes |
Pettersen | Kari | Storgt 20 | Stavanger |
The table above contains three records (one for each person) and four columns (LastName, FirstName, Address, and City).
With SQL, we can query a database and have a result set returned.
A query like this:
SELECT LastName FROM Persons |
Gives a result set like this:
LastName |
---|
Hansen |
Svendson |
Pettersen |
Note: Some database systems require a semicolon at the end of the SQL statement. We don't use the semicolon in our tutorials.
SQL (Structured Query Language) is a syntax for executing queries. But the SQL language also includes a syntax to update, insert, and delete records.
These query and update commands together form the Data Manipulation Language (DML) part of SQL:
The Data Definition Language (DDL) part of SQL permits database tables to be created or deleted. We can also define indexes (keys), specify links between tables, and impose constraints between database tables.
The most important DDL statements in SQL are:
Study our Complete SQL tutorial
From http://www.w3schools.com (Copyright Refsnes Data)