Table of contents
SQL consists of three components :
With SQL, zero to many rows at a time can be manipulated. This is one of the main differences between SQL and conventional file-based data. With file-based data, we generally use a program written in a language such as COBOL to process one row at a time. With SQL, we can process a set of rows. → the results of a SQL query can be returned to various places (depending on how the query is executed). Query output is often held in a temporary storage area, waiting to be retrieved by the display or access program or system.
<aside> 💡
The results of an SQL query can be returned to various places. Query output is often held in a temporary storage area, waiting to be retrieved by the display, the access program or the system
</aside>
<aside> ⛔
Bear in mind that the more complex the model, the longer it will take to execute the query (the use of complicated models can seriously degrade performance when large tables are involved)
</aside>
Table example: COMPANIES
COMPANY_NAME | COUNTRY | CREATION_YEAR |
---|---|---|
SNCF | FRANCE | 1938 |
NS | NETHERLANDS | 1938 |
ONCF | MOROCCO | 1963 |
DB | GERMANY | 1994 |
EUROSTAR | NULL ? | 1994 |
TRENITALIA | ITALY | 2000 |
SELECT
<column>
FROM
<table>
SELECT * FROM COMPANIES
--> dipslay all the table
<aside> ⛔
The columns to be selected should be separated by a comma ( , )
</aside>
WHERE
<criteria>
SELECT CREATION FROM COMPANIES
WHERE CREATION = 1938
--> SNCF
--> NS