Introduction to SQL

tags: #sql

What is SQL?

SQL is a Data Manipulation Language used to manipulate database (access, modify or retrieve the data).

This is different from Data Definition Language for specifying database schema structure.

SQL was originally coined as "SEQUEL"

Now popularly known as SQL - Structured Query Language

Executing SQL Statements

In SQL, a semicolon (;) is used to mark the end of a SQL statement.

It is used as a separator between multiple SQL statements in a batch, and it tells the database engine where each statement ends and where the next one begins.

This also makes your SQL code more portable and more consistent across different database platforms (not all DBMS require ; at the end of each statement).

Meaning of NULL

Meaning of NULL differs by context and data you are working with, but can be a result of:

Logical Values in SQL

SQL uses a three-valued logic involving: TRUE, FALSE, and UNKNOWN

Logical Connectives

AND CONNECTIVE TRUE FALSE UNKNOWN
TRUE TRUE FALSE UNKNOWN
FALSE FALSE FALSE FALSE
UNKNOWN UKNOWN FALSE UNKNOWN
OR CONNECTIVE TRUE FALSE UNKNOWN
TRUE TRUE TRUE TRUE
FALSE TRUE FALSE UNKNOWN
UNKNOWN TRUE UNKNOWN UNKNOWN
NOT CONNECTIVE
TRUE FALSE
FALSE TRUE
UNKNOWN UNKNOWN

Powered by Forestry.md