50 Most Useful SQL Queries: learn-by-doing
Structured Query Language (SQL) is a powerful tool for managing and
manipulating databases.
In this practical guide, we will explore the most useful SQL queries and delve into
their results. Each query will be accompanied by a comprehensive explanation,
enabling you to grasp their purpose and functionality.
Let’s embark on this journey of SQL exploration!
CONTENT
∘ Creating and Managing the Database
∘ Creating the Worker Table
∘ Inserting Data into the Worker Table
∘ Inserting Data into the Bonus Table
∘ Creating the Title Table
∘ Inserting Data into the Title Table
∘ Exploring The Database
∘ Conclusion
Creating the Practice Database
To begin, let’s create a database named “ORG” and switch to it using the following
SQL commands:
CREATE DATABASE ORG;
SHOW DATABASES;
USE ORG;
Creating the Worker Table
Next, let’s establish the “WORKER” table to store comprehensive employee
information.
This table will encompass columns such as worker ID, first name, last name, salary,
joining date, and department. Execute the subsequent SQL statement to create this
table:
CREATE TABLE WORKER (
WORKER_id INT NOT NULL PRIMARY KEY auto_increment,
FIRST_NAME CHAR(25),
LAST_NAME CHAR(25),
SALARY INT(15),
JOINING_DATE DATETIME,
DEPARTMENT CHAR(25)
);
Inserting Data into the Worker Table
Now, let’s populate the “WORKER” table with sample data representing various
employees.
The data includes worker IDs, names, salaries, joining dates, and departments.
Employ the following SQL statement to insert this data:
INSERT INTO WORKER (WORKER_ID, FIRST_NAME, LAST_NAME, SALARY,
JOINING_DATE, DEPARTMENT) VALUES
(001, 'Monika', 'Arora', 100000, '2020-02-14 09:00:00',
'HR'),
(002, 'Niharika', 'Verma', 80000, '2011-06-14 09:00:00',
'Admin'),
(003, 'Vishal', 'Singhal', 300000, '2020-02-14 09:00:00',
'HR'),
(004, 'Amitabh', 'Singh', 500000, '2020-02-14 09:00:00',
'Admin'),
(005, 'Vivek', 'Bhati', 500000, '2011-06-14 09:00:00',
'Admin'),
(006, 'Vipul', 'Diwan', 200000, '2011-06-14 09:00:00',
'Account'),
(007, 'Satish', 'Kumar', 75000, '2020-01-14 09:00:00',
'Account'),
(008, 'Geetika', 'Chauhan', 90000, '2011-04-14 09:00:00',
'Admin');
Creating the Bonus Table Let’s proceed by creating a table named “BONUS” to
capture bonus information for workers.
This table will encompass columns for worker reference ID, bonus amount, and
bonus date. Execute the subsequent SQL statement to create this table:
CREATE TABLE BONUS (
WORKER_REF_ID INT,
BONUS_AMOUNT INT(10),
BONUS_DATE DATETIME,
FOREIGN KEY (WORKER_REF_ID) REFERENCES WORKER(WORKER_ID) ON
DELETE CASCADE
);
Inserting Data into the Bonus Table
Next, we’ll populate the “BONUS” table with sample data, including worker
reference IDs, bonus amounts, and bonus dates.
Employ the following SQL statement to insert this data:
INSERT INTO BONUS (WORKER_REF_ID, BONUS_AMOUNT, BONUS_DATE)
VALUES
(001, 5000, '2020-02-16'),
(002, 3000, '2011-06-16'),
(003, 4000, '2020-02-16'),
(001, 4500, '2020-02-16'),
(002, 3500, '2011-06-16');
Creating the Title Table
Now, let’s establish a table named “TITLE” to capture worker titles.
This table will include columns for worker reference ID, worker title, and affected
from date. Execute the subsequent SQL statement to create this table:
CREATE TABLE TITLE (
WORKER_REF_ID INT,
WORKER_TITLE CHAR(25),
AFFECTED_FROM DATETIME,
FOREIGN KEY(WORKER_REF_ID) REFERENCES WORKER(WORKER_ID) ON
DELETE CASCADE
);
Inserting Data into the Title Table
We’ll insert some sample data into the “TITLE” table, encompassing worker
reference IDs, worker titles, and affected from dates.
Use the following SQL statement to insert this data:
INSERT INTO TITLE (WORKER_REF_ID, WORKER_TITLE, AFFECTED_FROM)
VALUES
(001, 'Manager', '2016-02-20 00:00:00'),
(002, 'Executive', '2016-06-11 00:00:00'),
(008, 'Executive', '2016-06-11 00:00:00'),
(005, 'Manager', '2016-06-11 00:00:00'),
(004, 'Asst. Manager', '2016-06-11 00:00:00'),
(007, 'Executive', '2016-06-11 00:00:00'),
(006, 'Lead', '2016-06-11 00:00:00'),
(003, 'Lead', '2016-06-11 00:00:00');
Running all the above scripts should produce the bellow results;
The “org” database
Now, let’s proceed to explore a series of SQL queries and their corresponding
results.
Exploring The Database
Query 1: Fetching First Names using Alias
SELECT FIRST_NAME AS WORKER_NAME FROM WORKER;
Fetching First Names using Alias
Explanation: This query retrieves the first names of workers from the “WORKER”
table, using the alias “WORKER_NAME” to represent the first name column.
Query 2: Fetching First Names in Uppercase
SELECT UPPER(FIRST_NAME) FROM WORKER;
Fetching First Names in Uppercase
Explanation: This query retrieves the first names of workers from the “WORKER”
table and converts them to uppercase using the UPPER() function.
Query 3: Fetching Unique Department Values
SELECT DISTINCT DEPARTMENT FROM WORKER;
Fetching Unique Department Values
Explanation: This query retrieves the unique department values from the
“WORKER” table, ensuring that each department appears only once in the result
set.
Query 4: Printing First Three Characters of First Names
SELECT SUBSTR(FIRST_NAME, 1, 3) FROM WORKER;
Printing First Three Characters of First Names
Explanation: This query retrieves the first names of workers from the “WORKER”
table and prints only the first three characters of each name using
the SUBSTR() function.
Query 5: Finding Position of ‘A’ in First Name ‘AMITABH’
SELECT INSTR(FIRST_NAME, BINARY 'a') FROM WORKER
WHERE
FIRST_NAME = 'AMITABH';
Finding Position of ‘A’ in First Name ‘AMITABH’
Explanation: This query searches for the position of the letter ‘a’ (case-sensitive)
in the first name column of the “WORKER” table. It specifically searches for the
name ‘AMITABH’ and returns the position of ‘a’ in that name.
Query 6: Printing First Names with Trailing White Spaces Removed
SELECT RTRIM(FIRST_NAME) FROM WORKER;
Printing First Names with Trailing White Spaces Removed
Explanation: This query retrieves the first names of workers from the “WORKER”
table and removes any trailing white spaces using the RTRIM() function.
Query 7: Printing Departments with Leading White Spaces Removed
SELECT LTRIM(DEPARTMENT) FROM WORKER;
Printing Departments with Leading White Spaces Removed
Explanation: This query retrieves the departments of workers from the
“WORKER” table and removes any leading white spaces using
the LTRIM() function.
Query 8: Fetching Unique Department Values and Their Lengths
SELECT DISTINCT LENGTH(DEPARTMENT) FROM WORKER;
Fetching Unique Department Values and Their Lengths
Explanation: This query retrieves the unique department values from the
“WORKER” table and calculates the length of each department using
the LENGTH() function. The result set will contain the distinct lengths of
departments.
Query 9: Replacing ‘a’ with ‘A’ in First Names
SELECT REPLACE(FIRST_NAME, 'a', 'A') FROM WORKER;
Replacing ‘a’ with ‘A’ in First Names
Explanation: This query retrieves the first names of workers from the “WORKER”
table and replaces all occurrences of ‘a’ with ‘A’ using the REPLACE() function.
Query 10: Printing First and Last Names Combined
SELECT CONCAT(FIRST_NAME, ' ', LAST_NAME) AS COMPLETE_NAME FROM
WORKER;
Printing First and Last Names Combined
Explanation: This query retrieves the first and last names of workers from the
“WORKER” table and concatenates them with a space in between, creating a single
column called “COMPLETE_NAME.”
Query 11: Sorting Worker Details by First Name in Ascending Order
SELECT * FROM WORKER ORDER BY FIRST_NAME ASC;
Sorting Worker Details by First Name in Ascending Order
Explanation: This query retrieves all the details of workers from the “WORKER”
table and sorts them in ascending order based on the first name.
Query 12: Sorting Worker Details by First Name in Ascending Order
and Department in Descending Order
SELECT * FROM WORKER ORDER BY FIRST_NAME ASC, DEPARTMENT DESC;
Sorting Worker Details by First Name in Ascending Order and Department in
Descending Order
Explanation: This query retrieves all the details of workers from the “WORKER”
table and sorts them first in ascending order based on the first name and then in
descending order based on the department.
Query 13: Fetching Details of Workers with First Names ‘Vipul’ and
‘Satish’
SELECT * FROM WORKER WHERE FIRST_NAME IN ('Vipul', 'Satish');
Fetching Details of Workers with First Names ‘Vipul’ and ‘Satish’
Explanation: This query retrieves the details of workers from the “WORKER”
table whose first names are either ‘Vipul’ or ‘Satish’.
Query 14: Fetching Details of Workers excluding First Names ‘Vipul’
and ‘Satish’
SELECT * FROM WORKER WHERE FIRST_NAME NOT IN ('Vipul',
'Satish');
Fetching Details of Workers excluding First Names ‘Vipul’ and ‘Satish’
Explanation: This query retrieves the details of workers from the “WORKER”
table whose first names are not ‘Vipul’ or ‘Satish’.
Query 15: Fetching Details of Workers in the Department ‘Admin’
SELECT * FROM WORKER WHERE DEPARTMENT = 'Admin';
Fetching Details of Workers in the Department ‘Admin’
Explanation: This query retrieves the details of workers from the “WORKER”
table who belong to the ‘Admin’ department.
Query 16: Fetching Details of Workers with First Names Containing ‘a’
SELECT * FROM WORKER WHERE FIRST_NAME LIKE '%a%';
Fetching Details of Workers with First Names Containing ‘a’
Explanation: This query retrieves the details of workers from the “WORKER”
table whose first names contain the letter ‘a’. The ‘%’ symbol acts as a wildcard,
matching any sequence of characters.
Query 17: Fetching Details of Workers with First Names Ending with
‘A’
SELECT * FROM WORKER WHERE FIRST_NAME LIKE '%a';
Fetching Details of Workers with First Names Ending with ‘A’
Explanation: This query retrieves the details of workers from the “WORKER”
table whose first names end with the letter ‘A’. The ‘%’ symbol acts as a wildcard,
matching any sequence of characters.
Query 18: Fetching Details of Workers with First Names Ending with
‘h’ and Containing Six Characters
SELECT * FROM WORKER WHERE FIRST_NAME LIKE '_____h';
Fetching Details of Workers with First Names Ending with ‘h’ and Containing
Six Characters
Explanation: This query retrieves the details of workers from the “WORKER”
table whose first names end with the letter ‘h’ and contain exactly six characters.
The ‘_’ symbol acts as a wildcard, matching a single character.
Query 19: Fetching Details of Workers with Salary between 100,000
and 500,000
SELECT * FROM WORKER WHERE SALARY BETWEEN 100000 AND 500000;
Fetching Details of Workers with Salary between 100,000 and 500,000
Explanation: This query retrieves the details of workers from the “WORKER”
table whose salaries fall between 100,000 and 500,000 (inclusive).
Query 20: Fetching Details of Workers Who Joined in February 2014
SELECT * FROM WORKER WHERE YEAR(JOINING_DATE) = 2014 AND
MONTH(JOINING_DATE) = 2;
Fetching Details of Workers Who Joined in February 2014
Explanation: This query retrieves the details of workers from the “WORKER”
table who joined in the month of February 2014.
Query 21: Fetching the Count of Employees in the ‘Admin’ Department
SELECT COUNT(*) FROM WORKER WHERE DEPARTMENT = 'Admin';
Fetching the Count of Employees in the ‘Admin’ Department
Explanation: This query retrieves the count of employees working in the ‘Admin’
department from the “WORKER” table using the COUNT(*) function.
Query 22: Fetching Worker Names with Salaries between 50,000 and
100,000
SELECT CONCAT(FIRST_NAME, ' ', LAST_NAME) FROM WORKER WHERE
SALARY BETWEEN 50000 AND 100000;
Fetching Worker Names with Salaries between 50,000 and 100,000
Explanation: This query retrieves the worker names from the “WORKER” table
whose salaries fall between 50,000 and 100,000. The CONCAT() function combines
the first name and last name with a space in between.
Query 23: Fetching the Number of Workers for Each Department in
Descending Order
SELECT DEPARTMENT, COUNT(WORKER_ID) FROM WORKER GROUP BY
DEPARTMENT ORDER BY COUNT(WORKER_ID) DESC;
Fetching the Number of Workers for Each Department in Descending Order
Explanation: This query retrieves the department names and the count of workers
in each department from the “WORKER” table. The result is sorted in descending
order based on the count of workers.
Query 24: Fetching Worker Details Who Also Hold the Title of
‘Manager’
SELECT W.* FROM WORKER W INNER JOIN TITLE T ON W.WORKER_ID =
T.WORKER_REF_ID AND T.WORKER_TITLE = 'Manager';
Fetching Worker Details Who Also Hold the Title of ‘Manager’
Explanation: This query retrieves the details of workers from the “WORKER”
table who also hold the title of ‘Manager’ in the “TITLE” table. It uses an inner join
to match the worker IDs between the two tables and filters the result based on the
worker title.
Query 25: Fetching Duplicate Records with Matching Data in Certain
Fields
SELECT WORKER_TITLE, AFFECTED_FROM, COUNT(*) FROM TITLE GROUP
BY WORKER_TITLE, AFFECTED_FROM HAVING COUNT(*) > 1;
Fetching Duplicate Records with Matching Data in Certain Fields
Explanation: This query retrieves the worker titles, affected dates, and the count
of duplicate records from the “TITLE” table. It groups the records based on worker
title and affected date and filters the result to include only those with a count greater
than 1.
Query 26: Showing Only the Odd Rows from a Table
SELECT * FROM WORKER WHERE MOD(WORKER_ID, 2) <> 0;
Showing Only the Odd Rows from a Table
Explanation: This query retrieves the records from the “WORKER” table where
the worker ID is not divisible by 2, effectively showing only the odd rows.
Query 27: Showing Only the Even Rows from a Table
SELECT * FROM WORKER WHERE MOD(WORKER_ID, 2) = 0;
Showing Only the Even Rows from a Table
Explanation: This query retrieves the records from the “WORKER” table where
the worker ID is divisible by 2, effectively showing only the even rows.
Query 28: Cloning a New Table from an Existing Table
DROP TABLE IF EXISTS WORKERCLONE;
CREATE TABLE WORKERCLONE LIKE WORKER;
INSERT INTO WORKERCLONE SELECT * FROM WORKER;
Explanation: This set of queries drops the existing “WORKERCLONE” table if it
exists, creates a new table with the same structure as the “WORKER” table, and
inserts all the records from the “WORKER” table into the “WORKERCLONE” table,
effectively cloning the table.
Query 29: Showing Records from One Table That Another Table Does
Not Have
SELECT * FROM WORKER
WHERE WORKER_ID NOT IN (SELECT WORKER_REF_ID FROM TITLE);
Showing Records from One Table That Another Table Does Not Have
Explanation: This query retrieves the records from the “WORKER” table that do
not have a corresponding worker reference ID in the “TITLE” table. It uses a
subquery to find the worker reference IDs in the “TITLE” table and excludes them
from the result.
Query 30: Showing the First Record from a Table
SELECT * FROM WORKER LIMIT 1;
Showing the First Record from a Table
Explanation: This query retrieves the first record from the “WORKER” table using
the LIMIT clause with a value of 1.
Query 31: Showing the Last Five Records from a Table
SELECT * FROM WORKER ORDER BY WORKER_ID DESC LIMIT 5;
Showing the Last Five Records from a Table
Explanation: This query retrieves the last five records from the “WORKER” table
by sorting them in descending order based on the worker ID and using
the LIMIT clause to restrict the result to five rows.
Query 32: Showing All Departments and the Total Salaries Paid for
Each
SELECT DEPARTMENT, SUM(SALARY) AS TOTAL_SALARY FROM WORKER
GROUP BY DEPARTMENT;
Showing All Departments and the Total Salaries Paid for Each
Explanation: This query retrieves the departments from the “WORKER” table and
calculates the total salary paid for each department using the SUM() function. The
result set includes the department name and the corresponding total salary.
Query 33: Showing the Names of Workers with the Highest Salary
SELECT CONCAT(FIRST_NAME, ' ', LAST_NAME) AS WORKER_NAME
FROM WORKER
WHERE SALARY = (SELECT MAX(SALARY) FROM WORKER);
Showing the Names of Workers with the Highest Salary
Explanation: This query retrieves the names of workers from the “WORKER”
table who have the highest salary. It uses a subquery to find the maximum salary
and compares it with the salary of each worker.
Query 34: Fetching the Three Highest Salaries from a Table
SELECT FIRST_NAME, SALARY
FROM WORKER
ORDER BY SALARY DESC
LIMIT 3;
Fetching the Three Highest Salaries from a Table
Explanation: This query retrieves the first name and salary of workers from the
“WORKER” table and sorts them in descending order based on the salary.
The LIMIT clause restricts the result to the top three records.
Query 35: Fetching the Three Lowest Salaries from a Table
SELECT FIRST_NAME, SALARY
FROM WORKER
ORDER BY SALARY ASC
LIMIT 3;
Fetching the Three Lowest Salaries from a Table
Explanation: This query retrieves the first name and salary of workers from the
“WORKER” table and sorts them in ascending order based on the salary.
The LIMIT clause restricts the result to the bottom three records.
Query 36: Fetching the Nth Max Salary from a Table
SELECT DISTINCT SALARY
FROM WORKER W1
WHERE n >= (
SELECT COUNT(DISTINCT SALARY)
FROM WORKER W2
WHERE W2.SALARY >= W1.SALARY
)
ORDER BY SALARY DESC
LIMIT 1;
Explanation: This query retrieves the Nth maximum salary from the “WORKER”
table.
It uses a subquery to count the distinct salaries greater than or equal to each salary
in the outer query and compares it with the provided value of N.
The result is sorted in descending order, and the LIMIT clause restricts it to one
record.
Query 37: Fetching Worker Details Who Joined in February 2014
SELECT *
FROM WORKER
WHERE YEAR(JOINING_DATE) = 2014 AND MONTH(JOINING_DATE) = 2;
Fetching Worker Details Who Joined in February 2014
Explanation: This query retrieves the details of workers from the “WORKER”
table who joined in February 2014.
It uses the YEAR() and MONTH() functions to extract the year and month from
the JOINING_DATE column and compares them with the specified values.
Query 38: Fetching the Count of Employees in Each Department
SELECT DEPARTMENT, COUNT(*) AS EMPLOYEE_COUNT
FROM WORKER
GROUP BY DEPARTMENT;
Fetching the Count of Employees in Each Department
Explanation: This query retrieves the department names and the count of
employees in each department from the “WORKER” table.
It uses the GROUP BY clause to group the records based on the department column
and applies the COUNT(*) function to count the employees in each group.
Query 39: Fetching Unique Worker Names Along with Their Respective
Departments
SELECT DISTINCT CONCAT(FIRST_NAME, ' ', LAST_NAME) AS
WORKER_NAME, DEPARTMENT
FROM WORKER;
Fetching Unique Worker Names Along with Their Respective Departments
Explanation: This query retrieves the unique worker names along with their
respective departments from the “WORKER” table.
It uses the DISTINCT keyword to eliminate duplicate combinations of worker
names and departments.
Query 40: Fetching Worker Names in Upper Case
SELECT UPPER(CONCAT(FIRST_NAME, ' ', LAST_NAME)) AS WORKER_NAME
FROM WORKER;
Fetching Worker Names in Upper Case
Explanation: This query retrieves the worker names from the “WORKER” table
and converts them to upper case using the UPPER() function.
The CONCAT() function combines the first name and last name with a space in
between.
Query 41: Fetching the First Three Characters of Worker First Names
SELECT SUBSTR(FIRST_NAME, 1, 3) AS FIRST_NAME_INITIALS
FROM WORKER;
Fetching the First Three Characters of Worker First Names
Explanation: This query retrieves the first three characters of worker first names
from the “WORKER” table using the SUBSTR() function.
It specifies the starting position as 1 and the length as 3.
Query 42: Finding the Position of the Letter ‘A’ in the First Name
‘AMITABH’
SELECT INSTR(FIRST_NAME, 'A') AS POSITION_OF_A
FROM WORKER
WHERE FIRST_NAME = 'AMITABH';
Finding the Position of the Letter ‘A’ in the First Name ‘AMITABH’
Explanation: This query finds the position of the letter ‘A’ in the first name
‘AMITABH’ from the “WORKER” table using the INSTR() function. It returns the
position of the first occurrence of 'A' in the first name.
Query 43: Printing the First Names with Right-Trimmed White Spaces
SELECT RTRIM(FIRST_NAME) AS TRIMMED_FIRST_NAME
FROM WORKER;
Printing the First Names with Right-Trimmed White Spaces
Explanation: This query retrieves the first names from the “WORKER” table and
removes any white spaces from the right side using the RTRIM() function.
Query 44: Printing the Departments with Left-Trimmed White Spaces
SELECT LTRIM(DEPARTMENT) AS TRIMMED_DEPARTMENT
FROM WORKER;
Printing the Departments with Left-Trimmed White Spaces
Explanation: This query retrieves the departments from the “WORKER” table and
removes any white spaces from the left side using the LTRIM() function.
Query 45: Fetching Unique Department Values and Printing Their
Lengths
SELECT DISTINCT DEPARTMENT, LENGTH(DEPARTMENT) AS
DEPARTMENT_LENGTH
FROM WORKER;
Fetching Unique Department Values and Printing Their Lengths
Explanation: This query retrieves the unique department values from the
“WORKER” table and calculates the length of each department name using
the LENGTH() function. It combines the department name and its length in the
result set.
Query 46: Printing First Names with ‘a’ Replaced by ‘A’
SELECT REPLACE(FIRST_NAME, 'a', 'A') AS MODIFIED_FIRST_NAME
FROM WORKER;
Printing First Names with ‘a’ Replaced by ‘A’
Explanation: This query retrieves the first names from the “WORKER” table and
replaces the lowercase ‘a’ with uppercase ‘A’ using the REPLACE() function. It
returns the modified first names in the result set.
Query 47: Concatenating First Name and Last Name into a Single
Column with a Space Separator
SELECT CONCAT(FIRST_NAME, ' ', LAST_NAME) AS FULL_NAME
FROM WORKER;
Concatenating First Name and Last Name into a Single Column with a Space
Separator
Explanation: This query concatenates the first name and last name of workers
from the “WORKER” table into a single column called “FULL_NAME.”
It uses the CONCAT() function to combine the first name, a space character (' '), and
the last name.
Query 48: Printing All Worker Details from the “WORKER” Table in
Ascending Order of First Name
SELECT *
FROM WORKER
ORDER BY FIRST_NAME ASC;
Printing All Worker Details from the “WORKER” Table in Ascending Order of
First Name
Explanation: This query retrieves all worker details from the “WORKER” table
and sorts them in ascending order based on the first name. The ORDER BY clause
with ASC specifies the ascending order.
Query 49: Printing All Worker Details from the “WORKER” Table in
Ascending Order of First Name and Descending Order of Department
SELECT *
FROM WORKER
ORDER BY FIRST_NAME ASC, DEPARTMENT DESC;
Printing All Worker Details from the “WORKER” Table in Ascending Order of
First Name and Descending Order of Department
Explanation: This query retrieves all worker details from the “WORKER” table
and sorts them in ascending order based on the first name and descending order
based on the department.
The ORDER BY clause specifies multiple columns and their respective sort orders.
Query 50: Printing Details of Workers with First Name ‘Vipul’ and
‘Satish’
SELECT *
FROM WORKER
WHERE FIRST_NAME IN ('Vipul', 'Satish');
Printing Details of Workers with First Name ‘Vipul’ and ‘Satish’
Explanation: This query retrieves the details of workers from the “WORKER”
table whose first names are either ‘Vipul’ or ‘Satish.’ The IN operator is used to
specify multiple values for the comparison.
Conclusion
In this practical guide, we continued to explore various SQL queries and their
corresponding results. We covered queries that involve string manipulation,
extracting specific characters, counting characters, trimming white spaces, and
retrieving unique values. We equally explored various SQL queries and their
corresponding results.
Also, queries that involve subqueries, retrieving specific records based on
conditions, aggregating data, and fetching the highest and lowest values.
Continue to refine your SQL skills and apply them to real-world scenarios to further
enhance your proficiency.
By practicing and understanding these queries, you’ll be able to perform advanced
data transformations and gain insights from your database. Continue to expand
your SQL knowledge and apply it to real-world scenarios to further enhance your
proficiency.