SQL 1o1: The Basics of SQL

SpaceBucket
4 min readDec 17, 2022

--

Part 1.1: Introduction to SQL

Let’s dive into the pool of SQL and get ourselves wet with the power of it!!

Introduction:

SQL (Structured Query Language) is a powerful programming language that is used for managing and organizing data in databases. It is a standard language for accessing and manipulating databases, and is widely used in a variety of industries, including finance, healthcare, and technology.

This is the rough flow!!

Importance of SQL

SQL is important for several reasons. First, it allows users to quickly and easily retrieve and manipulate large amounts of data from databases. This can be useful for tasks such as data analysis, and data mining. Second, SQL is a standard language, which means it is supported by most database management systems (DBMS) and can be used with a wide variety of databases. This makes it a versatile and flexible language that can be used in many different contexts.

In addition, SQL is a declarative language, which means that users specify what they want to do, rather than how to do it. This makes it easier to write and understand SQL queries and allows users to focus on the problem at hand, rather than getting bogged down in the details of implementation.

Overall, SQL is an important programming language that is essential for anyone who works with databases or large amounts of data. It is a powerful tool that can help users to access, manipulate, and analyze data, and is a valuable skill to have in many different industries quickly and easily.

There are several popular SQL databases, including:

  1. MySQL: an open-source SQL database management system
  2. PostgreSQL: an open-source object-relational database management system
  3. Microsoft SQL Server: a proprietary relational database management system developed by Microsoft
  4. Oracle: a proprietary relational database management system developed by Oracle Corporation
  5. SQLite: an open-source SQL database management system that is self-contained and does not require a separate server process

Structure of Data Stored in SQL

In SQL, tables are used to store data in a structured format. A table consists of rows (records) and columns (fields), and each row represents a unique instance of data, while each column represents a specific piece of data within that instance.

Some of the key elements of tables in SQL are the following:

1. Columns: Each table has one or more columns, which represent the different pieces of data that are stored in the table. Each column has a unique name and a specific data type, which determines the type of data that the column can hold (e.g., text, number, date).

2. Rows: Each table has one or more rows, which represent a single instance of data. Each row contains a set of values, one for each column in the table.

3. Primary key: A primary key is a column or set of columns that uniquely identifies each row in a table. A primary key cannot contain null values and must be unique across all rows in the table.

4. Foreign key: A foreign key is a column or set of columns that references the primary key of another table. It is used to establish a relationship between two tables.

Data Types in SQL:

In SQL, data types are used to specify the type of data that a column can hold. Some common data types used in SQL are as follows:

  1. INTEGER: a numerical data type that can hold whole numbers.
  2. REAL: a numerical data type that can hold floating-point numbers (i.e., numbers with decimal points).
  3. TEXT: a data type that can hold character strings (i.e., text).
  4. DATE: a data type that can hold date values.
  5. BOOLEAN: a data type that can hold the values TRUE or FALSE.

The specific data types available in SQL depend on the database management system (DBMS) being used. For example, MySQL and PostgreSQL have additional data types such as FLOAT, DECIMAL, and TIMESTAMP. It’s important to choose the appropriate data type for each column in a table to ensure that the data is stored and retrieved accurately.

This was part 1.1, consisting of the introduction to the SQL. Hope, we will be diving deeper in the coming blogs and learning together through this journey! Till then take good care, and happy coding!! Make sure you take on challenges and make progress, even a 0.0000000000000000001 progress is a progress!

--

--

No responses yet