curlylogic.dev logo

SQL: Beginners First Dive Into Data Analysis

Introduction

Structured Query Language (SQL) is a powerful tool in the world of data management, enabling users to interact with and manipulate databases efficiently. In this blog, we will delve into the fascinating history of SQL, explore its various options, and provide you with examples of its functions and methods to help you understand its capabilities and importance in the data-driven world.

What is Structured Query Language?

Structured Query Language often called as SQL is an amazing tool connected to data. It is a specialized programming language used for managing and manipulating relational databases. Since it works with relational databases, known as RDBMS or Relational Database Management System. It serves as a standard interface for interacting with databases, allowing users to perform various operations, such as querying data, updating data, defining and modifying database structures (tables, indexes, and views), and controlling access to data.

History of SQL

SQL's origins can be traced back to the 1970s when IBM developed a language called SEQUEL (Structured English Query Language). This language laid the foundation for modern SQL and aimed to simplify the management of data stored in databases.In the 1980s, SQL became the standardized language for managing relational databases, thanks to the efforts of the American National Standards Institute (ANSI) and the International Organization for Standardization (ISO). SQL-86 was the first official standard, and subsequent versions have continued to enhance and refine the language. Since then SQL is constantly evolving and is now in its present form.

Different Options for SQL

SQL has many different options tailored for different database systems. Some popular ones include:

  • MySQL: An open-source relational database management system often used for web applications.
  • PostgreSQL: Known for its robust features and extensibility, it is also open-source.
  • Microsoft SQL Server: A Microsoft product designed for enterprise-level database management.
  • Oracle Database: A powerful, commercial database system used in large enterprises.
  • SQLite: A lightweight and self-contained database often used in mobile and embedded applications.

These are famous options for SQL. There are some more besides these.

Let's start working with SQL. Wait wait wait, can we really start working? What do we work with? What do we work on? We can't start working without knowing the key components of SQL. Let's learn about them first.

  1. Tables: Data in SQL is organized into tables, each of which has a predefined structure with columns and rows. Columns represent the attributes or fields of the data, while rows contain individual records.
  2. Relationships: Tables in SQL can be related to each other through keys, typically primary keys and foreign keys. This allows for the creation of relationships between tables, facilitating data retrieval and ensuring data consistency.
    1. Primary Keys: A primary key is a column or a set of columns that uniquely identifies each record (row) in a table. It must contain unique values, and it cannot have NULL values. This is defined using the PRIMARY KEY constraint.
    2. Foreign Keys: A foreign key establishes a link between two tables by referencing the primary key column(s) of another table. It ensures referential integrity between the tables. It is defined using the FOREIGN KEY constraint.
  3. Constraints: Constraints are rules applied to data in the database to maintain data integrity. It constraint particular things to work in a particular way. Common constraints are Primary Key, Foreign Key, Unique Constraint, Check Constraint
  4. Schema: The structure of the database, including the tables, relationships, and constraints, is defined by a schema. The schema specifies the rules for organising and interacting with the data.
  5. Database: A database is a structured collection of electronically stored data. These data can be accessed, managed, modified, updated, controlled, and organised with the help of SQL language.
  6. SQL Language: SQL serves as the language for interacting with SQL databases. It includes two main categories of commands:
    1. Data Definition Language (DDL): DDL is used for defining and managing the structure of the database, including creating, altering, and deleting tables and indexes.
    2. Data Manipulation Language (DML): It is used for querying and manipulating data within the database, including operations like SELECT, INSERT, UPDATE, and DELETE.
    3. Data Control Language (DCL): DCL includes commands such as GRANT and REVOKE which mainly deal with the rights, permissions, and other controls of the database system.
    4. Transaction Control Language (TCL): TCL is used to give a safety feature while working with SQL. We can use a point to check the code and then save it or even move back to previous version if we had. TCL methods are COMMIT, ROLLBACK, SAVEPOINT.

Conclusion

Let's conclude this part here. We have taken some basic understanding of SQL. Its history, its different variants and the key components we need for wroking with SQL. In the next part we'll delve deep into the methods and functionality SQL provide us.Stay tuned for the next part.Thanks

Return To All articles