SQL Basis Cursus

SQL is the standard computer language used to access and process databases.

Managing data through SQL

Structured Query Language (SQL) is the standard language used to access databases, including SQL Server, Oracle, MySQL, Sybase, and Access, etc.

For those who want to store data in a database and retrieve data from it, knowledge of SQL is invaluable.

What is SQL?

  • SQL is a Structured Query Language (Structured Query LLanguage)
  • SQL gives us the ability to access databases
  • SQL is an ANSI standard computer language
  • SQL is used to execute queries on databases
  • SQL can retrieve data from the database
  • SQL can insert new records into the database
  • SQL can delete records from the database
  • SQL is easy to learn

Editor's note:ANSI, American National Standards Institute

SQL is a standard - but...

SQL is an ANSI standard computer language used to access and operate database systems. SQL statements are used to retrieve and update data in the database. SQL can work with database programs such as MS Access, DB2, Informix, MS SQL Server, Oracle, Sybase, and other database systems.

Unfortunately, there are many different versions of the SQL language, but in order to be compatible with the ANSI standard, they must support some main keywords in a similar way together (such as SELECT, UPDATE, DELETE, INSERT, WHERE, etc.).

Opmerking:In addition to the SQL standard, most SQL database programs have their own private extensions!

SQL database table

A database typically contains one or more tables. Each table is identified by a name (such as "Customers" or "Orders"). Tables contain records (rows) with data.

The following example is a table named "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 (each corresponding to a person) and four columns (surname, name, address, and city).

SQL query program

Met SQL kunnen we een database raadplegen en een resultatenverzameling verkrijgen die wordt geretourneerd.

Een queryprogramma ziet er ongeveer zo uit:

SELECT LastName FROM Persons

De resultatenlijst ziet er ongeveer zo uit:

LastName
Hansen
Svendson
Pettersen

Opmerking:Sommige database systemen vereisen dat er een puntkomma wordt gebruikt aan het einde van SQL-opdrachten. In ons cursus gebruiken we geen puntkomma's.

SQL Data Manipulatie taal (DML)

SQL (Structural Query Language) is de syntaxis voor het uitvoeren van queries. Maar het SQL-taal bevat ook syntaxis voor het updaten, invoegen en verwijderen van records.

Deze query- en update-staten komen allemaal uit het DML-deel van SQL:

  • SELECT - Data uit database tabel ophalen
  • UPDATE - Data in database tabel updaten
  • DELETE - Data verwijderen uit database tabel
  • INSERT INTO - Data invoegen in database tabel

SQL Data Definitie taal (DDL)

Het DDL-deel van SQL geeft ons de mogelijkheid om tabellen te maken of te verwijderen. We kunnen ook indexes (sleutels) definiëren, verbindingen tussen tabellen regelen en beperkingen op tabellen toepassen.

De belangrijkste DDL-sommen in SQL:

  • CREATE TABLE - Maak nieuwe tabel aan
  • ALTER TABLE - Verander (wijzigen) database tabel
  • DROP TABLE - Verwijder tabel
  • CREATE INDEX - Maak index (zoektoegang) aan
  • DROP INDEX - Verwijder index

SQL Cursus

Ler het van CodeW3C.com aangeboden SQL Cursus.