No history yet

Introduction to SQL

What is SQL?

At its core, Structured Query Language, or SQL, is the universal language for communicating with databases. Think of a database as a massive, incredibly organized library. You wouldn't just wander in and start shouting for the book you want. Instead, you'd ask a librarian for help, using a specific set of instructions.

SQL, or Structured Query Language, is a language to talk to databases.

SQL is that set of instructions. It allows you to ask the database to retrieve specific information, add new data, update existing entries, or delete records. It’s the bridge between you and the vast amounts of information stored in a database, providing a standardized way to manage and manipulate that data.

A Quick Trip Back in Time

SQL isn't a new invention. Its story begins in the early 1970s at IBM, born from a need to manage data in a new type of database system called a relational database. The goal was to create a language that was powerful yet relatively easy for people to read and write.

By the 1980s, SQL had proven so effective that it was adopted as a standard by both the American National Standards Institute (ANSI) and the International Organization for Standardization (ISO). This was a huge step. It meant that, with minor variations, the same language could be used across many different database systems, making it a versatile and essential skill for anyone working with data.

The Filing Cabinet of Data

SQL is designed to work with relational databases. The concept is simpler than it sounds. Imagine your data is organized in a series of filing cabinets. Each cabinet is a database.

Inside each cabinet, you have drawers, and in each drawer, you have neatly organized folders. In a database, these folders are called tables. A table organizes information into rows and columns, much like a spreadsheet.

CustomerIDNameEmail
1Alice Smithalice@email.com
2Bob Johnsonb.johnson@email.com
3Charlie Browncharlie@email.com

The "relational" part comes from the ability to link, or relate, these tables to each other. For example, you might have one table for customer information and another for their orders. Instead of repeating all the customer information for every single order, you can simply link the tables using a common piece of information, like a CustomerID.

This structure is incredibly efficient. It avoids duplicating data and keeps everything clean, organized, and easy to manage.

Different Flavors of SQL

While SQL is a standard, different database systems often have their own unique additions and variations, sometimes called "dialects." Think of it like the difference between American English and British English. The core language is the same, but there are minor differences in vocabulary and spelling.

Although SQL can be used in all relational databases, many databases have some syntax after the standard, which we can call "dialects."

Learning the standard SQL commands will get you very far on any system. Here are a few of the most popular database systems you'll encounter:

  • MySQL: A widely-used, open-source database, popular for web applications. It's known for its reliability and ease of use.
  • PostgreSQL: Also open-source, PostgreSQL is praised for its advanced features and ability to handle complex queries and large amounts of data.
  • Microsoft SQL Server: A powerful system developed by Microsoft, commonly used in large corporate environments, especially those that rely on other Microsoft products.
  • SQLite: A lightweight, self-contained database that's perfect for smaller applications, including mobile apps and web browsers. It doesn't require a separate server to run.

Each has its strengths, but they all speak the same fundamental language: SQL.

Ready to test your knowledge on these foundational concepts?

Quiz Questions 1/4

What is the primary function of Structured Query Language (SQL)?

Quiz Questions 2/4

The "relational" in "relational database" refers to the ability to:

Now that you have a high-level view of what SQL is and why it's used, you're ready to start exploring the specific commands that make it all work.