DEV Community

Ichabodi
Ichabodi

Posted on

SQL 101: Introduction to SQL for Data Analysis

Structured query language (SQL)
is a programming language for storing and processing information in a relational database. A relational database stores information in tabular form, with rows and columns representing different data attributes and the various relationships between the data values.

Image description

               **Advantages of SQL**
Enter fullscreen mode Exit fullscreen mode

SQL has several benefits that have helped it become increasingly popular in the field of data science. It’s a wonderful query language for data professionals and users to interface with databases. The advantages or benefits of SQL are as follows:

Query Processing at a High Speed
SQL queries are used to obtain a large volume of data from the database fast and efficiently. Data activities such as insertion, deletion, and updating take less time.
There is no need to code.
For database management, SQL does not need a huge amount of coding lines. Using basic SQL syntactical rules, we can quickly access and maintain the database.

Flexibility
Desktop computers, laptops, tablets, and even smartphones may all use the structured query language. It can also be used in concert with other programming languages, depending on the needs of the user.

Language is defined
SQL adheres to ISO and ANSI standards, which provide a consistent platform for all of its users across the world.

            **Disadvantages of SQL**
Enter fullscreen mode Exit fullscreen mode

It also has disadvantages which are as follows:

Price
Some SQL versions have a significant operating cost. As a result, some developers don’t use SQL.

The User Interface Is Complicated
Another significant downside is that the Structured query language interface is complex, making it difficult for SQL users to use and administer.

Database control its portion
The business regulations are kept under wraps. As a result, data professionals and users who utilize this query language are unable to have complete database control.

There are some most commonly used SQL commands:

Image description

CREATE command.
SELECT command.
INSERT command.
DROP command.
DELETE command.

SQL CREATE DATABASE Command

CREATE DATABASE database_name;

SQL CREATE TABLE Command
CREATE TABLE table_name(
column1 datatype,
column2 datatype,
column3 datatype,

SQL SELECT Command

SELECT column1, column2....columnN
FROM table_name;

SQL INSERT INTO Command
INSERT INTO table_name( column1, column2....columnN)
VALUES (value1, value2....valueN);

SQL DROP DATABASE Command

DROP DATABASE database_name;

SQL DROP TABLE Command

DROP TABLE table_name;

SQL DELETE Command

DELETE FROM table_name
WHERE{CONDITION};

There are other commands that are also used, like:

SQL WHERE Clause

SELECT column1, column2....columnN
FROM table_name
WHERE CONDITION;

SQL AND/OR Clause

SELECT column1, column2....columnN
FROM table_name
WHERE CONDITION-1 {AND|OR} CONDITION-2;

SQL IN Clause

SELECT column1, column2....columnN
FROM table_name
WHERE column_name IN (val-1, val-2,...val-N);

SQL BETWEEN Clause

SELECT column1, column2....columnN
FROM table_name
WHERE column_name BETWEEN val-1 AND val-2;

SQL LIKE Clause

SELECT column1, column2....columnN
FROM table_name
WHERE column_name LIKE { PATTERN };

SQL ORDER BY Clause

SELECT column1, column2....columnN
FROM table_name
WHERE CONDITION
ORDER BY column_name {ASC|DESC};

SQL GROUP BY Clause

SELECT SUM(column_name)
FROM table_name
WHERE CONDITION
GROUP BY column_name;

SQL COUNT Clause

SELECT COUNT(column_name)
FROM table_name
WHERE CONDITION;

SQL HAVING Clause

SELECT SUM(column_name)
FROM table_name
WHERE CONDITION
GROUP BY column_name
HAVING (arithematic function condition);
columnN datatype,
PRIMARY KEY( one or more columns )
);

SQL CREATE UNIQUE INDEX Command

CREATE UNIQUE INDEX index_name
ON table_name ( column1, column2,...columnN);
SQL DROP INDEX Command
ALTER TABLE table_name
DROP INDEX index_name;
SQL DESC Command
DESC table_name;

SQL in data analysis is a standardized language that is used to query or retrieve data from a relational database.
Within languages like Python, Scala, and Hadoop, which are most popular currently in use for data science along with big data management and manipulation.

What skills are needed for data analyst?

Programming Knowledge: As an SQL Data Analyst, one must be fluent in writing scripts, and queries and must know other Programming Languages as well.
Advanced Computer Skills: The job role of a SQL Analyst also requires advanced computer knowledge. They must have basic knowledge on the hardware of devices.

Top comments (1)

Collapse
 
chrisgreening profile image
Chris Greening

Thank you for sharing!

I've been thinking of integrating SQL further into my workflow for data analysis tasks - typically I use SQL just for extracting/loading data and I use Python or R for transforming, exploring, and analyzing but I really love SQL's syntax and it would let me leverage the data warehouse's compute power and move closer to the data

Definitely an incredible tool :~)