Introduction to SQL Programming

 

What is SQL?

SQL stands for Stuctured Query Language.  It is a domain-specific language used in programming and designed for managing data held in a relational database management system (RDBMS), or for stream processing in a relational data stream management system (RDSMS).

However, in this article I will introduce what is SQL, what are some elements in SQL, how to name things, and what are some data types in SQL.

In this new category I will introduce some of the common statements in SQL and I will divide them into sections, which include:

  • What is SQL?
  • What is the Language Elements
  • Naming things
  • Data types
  • Using SELECT
  • FROM
  • WHERE Clause
  • AND and OR
  • LIKE
  • IS and IS NOT
  • JOINS (LEFT JOIN, RIGHT JOIN, FULL JOIN)
  • ORDER BY
  • GROUP BY
  • (Adding, removing, and deleting data) INSERT, UPDATE, DELETE
  • Creating tables (ALTER, DROP, CREATE TABLE)
  • null OR NOT NULL
  • PRIMARY KEY, AND CONSTRAINTS

Language elements

A chart showing several of the SQL language elements that compose a single statement

The SQL language is subdivided into several language elements, including:

  • Clauses, which are constituent components of statements and queries. (In some cases, these are optional.)[17]
  • Expressions, which can produce either scalar values, or tables consisting of columns and rows of data
  • Predicates, which specify conditions that can be evaluated to SQL three-valued logic (3VL) (true/false/unknown) or Boolean truth values and are used to limit the effects of statements and queries, or to change program flow.
  • Queries, which retrieve the data based on specific criteria. This is an important element of SQL.
  • Statements, which may have a persistent effect on schemata and data, or may control transactions, program flow, connections, sessions, or diagnostics.
    • SQL statements also include the semicolon (“;”) statement terminator. Though not required on every platform, it is defined as a standard part of the SQL grammar.
  • Insignificant whitespace is generally ignored in SQL statements and queries, making it easier to format SQL code for readability.

 

Naming things in SQL

SQL Data types

Stay tuned for the next article when I go deeper into the syntax of SQL language.  Here’s what I will feature next:

  • Using SELECT
  • the FROM clause
  • WHERE

Thanks for reading!

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s