What is SQL?

What is SQL?


SQL stands for Structured Query Language, SQL is a standard language for accessing databases, SQL has been an international standard (ISO) since 1987

SQL Statements

To access a database, you use SQL statements.

The following SQL statement selects all records in a database table called "Customers":

Example

SELECT * FROM Customers;

Database Tables

A database most often contains one or more tables.

Each table is identified by a name like "Customers" or "Orders".

Below is a selection from a "Customers" table:

IDCustomerNameContactNameAddressCityPostalCodeCountry
1

Alfreds FutterkisteMaria AndersObere Str. 57Berlin12209Germany
2Ana Trujillo Emparedados y heladosAna TrujilloAvda. de la Constitución 2222México D.F.05021Mexico
3Antonio Moreno TaqueríaAntonio MorenoMataderos 2312México D.F.05023Mexico
4

Around the HornThomas Hardy120 Hanover Sq.LondonWA1 1DPUK
5Berglunds snabbköpChristina BerglundBerguvsvägen 8LuleåS-958 22Sweden

The table above contains five records (one for each customer) and seven columns:

  1. CustomerID (ID)
  2. CustomerName
  3. ContactName
  4. Address
  5. City
  6. PostalCode
  7. Country

The Most Important SQL Statements:

  • SELECT - extracts data from a database
  • UPDATE - updates data in a database
  • DELETE - deletes data from a database
  • INSERT INTO - inserts new data into a database
  • CREATE DATABASE - creates a new database
  • ALTER DATABASE - modifies a database
  • CREATE TABLE - creates a new table
  • ALTER TABLE - modifies a table
  • DROP TABLE - deletes a table
  • CREATE INDEX - creates an index (search key)
  • DROP INDEX - deletes an index

SQL keywords are NOT case sensitive: select is the same as SELECT

Full SQL Tutorial

This has been a short introduction to SQL.

For a full SQL tutorial go to W3Schools SQL Tutorial.

Comments

Popular Posts