Intro to SQL

Intro to SQL

Before learning about SQL, let us take a step back to understand what SQL does and why it is important. SQL, oftentimes pronounced, “Sequel” or “ess-q-uel” is a structured query language whose main purpose is to interact with a database. If you are anything like me you’re thinking, “what?” Let me decouple the definition of SQL. SQL is a structured query language, meaning there are rules to follow in order to query (ask) the database to return the selected information from said database. SQL follows simplistic CRUD operations. If you are unfamiliar with the terminology, CRUD is a commonly used tool in programming to create, read(retrieve), update, and delete information or items from a database or website application. It is a paramount aspect of your life as a developer and a life without CRUD is, quite frankly, difficult to imagine. SQL uses a similar commonly used tactic for querying a database. These commands are SELECT, INSERT, UPDATE, and DELETE. The definitions are as follows:

StatementDescription
SELECTRetrieves data from one or more tables.
INSERTAdds one or more new rows to a table.
UPDATEChanges one or more existing rows in a table.
DELETEDeletes one or more existing rows from a table.

It is typical for a SQL programmer to use these data manipulation language statements to work with the data in the database. If you are a database administrator, your SQL statements will be used to work with database objects and will look like this:

StatementDescription
CREATE DATABASECreates a new database.
CREATE TABLECreates a new table in a database.
CREATE INDEXCreates a new index for a table.
  
ALTER TABLEChanges the structure of an existing table.
ALTER INDEXChanges the structure of an existing index.
  
DROP DATABASEDeletes an existing database.
DROP TABLEDeletes an existing table.
DROP INDEXDeletes an existing index.

Despite your reason for wanting to learn SQL or your job responsibilities, you can see basic CRUD operations in action! One thing to note, writing in all caps gets a bad rap. I promise that I am not yelling at you. But while querying a database, it is always important to differentiate between the reserved SQL keywords and your statements. It is not a mandate nor a requirement of the nomenclature, but you will see me use all caps frequently throughout this course. In the next blog post, I will provide a brief written explanation about the relational database model.

Follow Me