A Quick Guide to Standard Query Language

Understanding and Utilising SQL Functions and Operators.

Gloria Okoba
DATA4FASHION
3 min readFeb 9, 2023

--

SQL
Replace with the image sources

SQL (Structured Query Language) is a programming language used for managing and manipulating relational databases. It is used to insert, update, and retrieve data from a database, and is the standard language for relational database management systems such as MySQL, Oracle, and Microsoft SQL Server.

SQL is a declarative language, meaning that you describe what you want the database to do, and the database management system takes care of actually performing the tasks.

For example, to retrieve all of the records from a table in a database, you would write the following SQL statement:

SELECT * FROM table_name;

This statement says, “select all columns from the table named table_name”. The * symbol is a wildcard that tells SQL to return all of the columns in the table.

SQL also provides a number of functions that can be used to manipulate the data in a database. Some of the most commonly used functions include:

1. AVG: Returns the average value of a column in a table. For example:

SELECT AVG(column_name) FROM table_name;

2. COUNT: Returns the number of rows in a table. For example:

SELECT COUNT(*) FROM table_name;

3. MAX: Returns the maximum value in a column. For example:

 SELECT MAX(column_name) FROM table_name;

4. MIN: Returns the minimum value in a column. For example:

SELECT MIN(column_name) FROM table_name;

5. SUM: Returns the sum of all values in a column. For example:

SELECT SUM(column_name) FROM table_name;

In addition to these functions, SQL provides a number of operators that can be used to filter data based on specific conditions.

For instance, the following SQL statement that returns all of the records in a table where the value of the column_name column is greater than 10:

SELECT * FROM table_name WHERE column_name > 10;

SQL also provides a way to join multiple tables together, allowing you to retrieve data from multiple sources and combine it into a single result. For example, the following SQL statement joins two tables, table_1 and table_2, based on the value of the column_name column:

SELECT * FROM table_1
JOIN table_2
ON table_1.column_name = table_2.column_name;

SQL provides a flexible and powerful way to work with relational databases, and is a critical tool for any data analyst or data scientist.

Whether you are working with large data sets or just need to manage a small database, SQL provides a rich set of features and functions that make it easy to manipulate and retrieve data from a database.

CONCLUSION

In conclusion, SQL is an essential language for working with relational databases. With its powerful set of functions and operators, it provides a flexible and efficient way to manage, manipulate, and retrieve data from a database.

Whether you are a data analyst, data scientist, or database administrator, a solid understanding of SQL is an important skill that will help you to be more productive and efficient in your work.

--

--

Gloria Okoba
DATA4FASHION

Sales/data analyst. Twitter:@dat_godwoman Excel/SQL/Power BI/Looker Studio