Overview of SQL

SQL is based on expressions of English. It is a declarative language - specify only what must be done, but does not specify how.

Native SQL is used for the following purposes:

  • specifying queries
  • data handling - DML (Data Modification Language) - insert, modify and delete data from a database
  • data definition - DDL (Data Definition Language) - adding new objects to the database
  • Control data - DCL (Data Control Language) - to determine the rights of access

SQL Rules

Writing a SQL Command

  • SQL commands can be arranged in several lines. Marks the end of the SQL command with a semicolon
  • We recommend placing the clauses of the new line
  • You can use tabs
  • Do not share words between lines
  • Whether you use small or capital letters, unless we check the contents of the field.

The basic building block of SQL queries

Using the SELECT command are aware of the database.

SELECT command consists of at least the SELECT clause and a FROM clause. In the SELECT clause list the columns of interest to us. The FROM clause point out where to download the data. To retrieve the names of employees and their profession, we write:

SELECT ENAME, JOB
FROM EMP;

The column names separated by commas.

To select all of the table type * (asterisk) instead of a list of columns.

SELECT * FROM EMP;

No comments: