SQL Basics: Understanding Database Structures

Learn SQL with Udemy

For an instructor lead, in-depth look at learning SQL click below.


SQL, which stands for structured query language, is a programming language that is used to communicate with and manipulate databases. If you’re just diving into the world of data, it’s crucial to understand SQL, as it is a key tool for anyone working in modern data-driven industries. Before we get started with the practical side, let’s overview some fundamental concepts of database structures.

What is a Database?

A database is an organized collection of data stored and accessed electronically. Databases allow us to store, manage, and retrieve that data efficiently. They can hold a variety of data types, including text, numbers, dates, and more. In SQL, data within databases is often structured in tables.

Understanding Tables

In SQL, a table is a collection of related data held in a structured format within a database. It consists of columns, and rows. Every table is broken up into smaller entities called fields. The fields in the Customers table consist of CustomerID, CustomerName, ContactName, Country, etc. Each row is referred to as a record and is identified by a unique key referred to as a Primary Key.

Indexes

Indexes are used to retrieve data from databases more quickly than otherwise. They are particularly useful on large tables and can drastically reduce the amount of time to run queries.

Here is an example of how to create an index in SQL:

Queries and Commands

A SQL query is a question you ask the database. The database returns a result set, which is a list of data that meets the conditions of your query. SQL commands can be divided into several different types, among them Data Manipulation Language (DML) and Data Definition Language (DDL).

Here are some examples:

Conclusion

In this article, we’ve discussed the very basics of SQL and discussed some common terms. The real power of SQL lies in its ability to manage large amounts of data, quickly retrieve information and make data manipulation easy.


Leave a Comment