SlideShare a Scribd company logo
1 of 14
Download to read offline
Presented By:
Mansi Jain
Sr. Software Consultant
Knoldus Inc
Basics on SQL queries &
Query Optimization
Lack of etiquette and manners is a huge turn off.
KnolX Etiquettes
Punctuality
Join the session 5 minutes prior
to the session start time. We
start on time and conclude on
time!
Feedback
Make sure to submit a
constructive feedback for all
sessions as it is very helpful for
the presenter.
Silent Mode
Keep your mobile devices in
silent mode, feel free to move
out of session in case you need
to attend an urgent call.
Avoid Disturbance
Avoid unwanted chit chat during
the session.
Our Agenda
2
01
Query Processing in SQL
3
02
Important clauses/commands of SQL
4
03
5
04
Joins
6
05
Order Of Executions with Example
7
8
Data Definition Language
1 What is SQL ?
Data Manipulation Language
Query Optimization
What is SQL ?
● SQL(Structured Query Language) is an ANSI
standard language for accessing and manipulating
relational databases.
● It includes database creation, deletion, fetching rows,
modifying rows, etc.
● All the Relational Database Management Systems
(RDMS) like MySQL, MS Access, Oracle, Sybase,
Informix, Postgres and SQL Server use SQL as their
standard database language.
Note : Database is collection of data in the form of tables.
Query Processing in SQL
● Each SQL query is gone
through a processor
where it is translated and
optimized.
● Here, parser is basically
translator.
● DBMS Engine is the
executing engine which
executes the data.
● Then, query result
impacts the physical
database.
Important clauses/commands of SQL
● SELECT
● FROM
● WHERE
● GROUP BY
● HAVING
● ORDER BY
● LIMIT
● AS
● JOIN
● IN
● LIKE
● COUNT (column_name)
● SUM (column_name)
● MAX/MIN (column_name)
● AVG(column_name)
● IS NULL/ IS NOT NULL
● COMMIT
● ROLLBACK
● AND
● OR
● DISTINCT
● ON/ USING
Data Definition Language
● CREATE - This is used to create table, database, index and view.
CREATE DATABASE databasename;
CREATE TABLE table_name (column1 datatype, column2 datatype,..);
CREATE INDEX index_name ON table_name (column1, column2,..);
CREATE VIEW view_name AS SELECT column1, column2, ...
FROM table_name WHERE condition;
● ALTER - This is used to add/remove/rename/update column from table
ALTER TABLE table_name ADD column_name datatype;
ALTER TABLE table_name DROP COLUMN column_name;
ALTER TABLE table_name RENAME COLUMN column_name;
ALTER TABLE table_name DROP INDEX index_name; //MySQL
Note : VIEW - Improve security of database by showing intended data to authorised user.
Data Definition Language continue..
● TRUNCATE - This is used to delete data inside the table, not the table itself.
TRUNCATE TABLE table_name;
● DROP - This is used to delete table, database, index and view
DROP DATABASE databasename;
DROP TABLE table_name;
DROP INDEX table_name.index_name; //SQL server
DROP VIEW [view_name];
Data Manipulation Language
● UPDATE - To modify existing data inside a table.
UPDATE table_name
SET column1 = value1, column2 = value2, … WHERE condition;
UPDATE Students
SET StudentName = 'Alfred’, City= 'Delhi' WHERE ID = 1;
● INSERT - To add single row data in to table.
INSERT INTO table_name (column1, column2, column3, ...)
VALUES (value1, value2, value3, ...);
INSERT INTO Students (StudentName, City)
VALUES ('Alfred’, 'Delhi');
Data Manipulation Language
● DELETE - To delete specific rows in a table. Once deleted cannot be
recovered.
DELETE FROM table_name WHERE condition;
DELETE FROM Students WHERE StudentName='Alfred';
● SELECT - To select data from a table.
SELECT column1, column2, ...
FROM table_name;
SELECT DISTINCT Country FROM Students;
Order Of Execution with example
1. FROM - add tables names and joined them together to get base data.
In this command, we can use AS to rename table for reference with alias & JOIN
to add more table and ON to apply check on based on which tables will be joined.
2. WHERE - optional, to filter on resultant base data set
3. GROUP BY - after data is filter, we group rows of resultant set having same value.
4. HAVING - optional, same as Where clause, restrict rows affected by group by clause.
5. SELECT - final result is returned based on above filter clauses.
6. ORDER BY - sort the selected data, by default way of sorting is ASC, can be DESC.
7. LIMIT - restrict the result upto given no. of rows, it gives row no. from where to start and end.
Example - SELECT cs.first_name, MAX(os.amount) AS OrderAmt
FROM Customers AS cs
JOIN Orders AS os ON cs.customer_id = os.customer_id
WHERE os.order_id <4 ORDER BY os.order_id DESC
GROUP by first_name (if column name is in one table only, no need for reference)
HAVING MAX(Orders.amount) <=400 (optional)
LIMIT 2,4 or LIMIT 2 ;
Query Optimization
Process of selecting the most effective way to carry out a SQL statement.
● Avoid Select Distinct - although handy way to remove duplicates from a query, but data may be
grouped to the point of being inaccurate and Inefficient. To avoid using it, select more fields to create
unique results.
● INNER JOIN V/S WHERE - WHERE works with some DBMS system which consider it as INNER JOIN
but not all. This type of join (where) creates a Cartesian Join, also called a Cartesian Product or CROSS
JOIN. Use INNER JOIN instead of WHERE when two or more tables are joined together to get data.
● Select required fields instead of using select * - Specify columns to avoid extra fetching load on DB.
● Use Limit to sample query results- always fetch limited data to decrease response time of a query.
● Use wildcards at the end of a phrase only- as they search the entire database for matching results.
● Use Indexing: Ensure proper indexing for quick access to the database.
● Avoid using clauses like Initcap, Lower, Upper - as they increase the query response time.
Thank You !
,

More Related Content

Similar to Basics on SQL queries

SQL.pptx for the begineers and good know
SQL.pptx for the begineers and good knowSQL.pptx for the begineers and good know
SQL.pptx for the begineers and good know
PavithSingh
 
SQL: Structured Query Language
SQL: Structured Query LanguageSQL: Structured Query Language
SQL: Structured Query Language
Rohit Bisht
 

Similar to Basics on SQL queries (20)

SQL | DML
SQL | DMLSQL | DML
SQL | DML
 
[PHPUGPH] PHP Roadshow - MySQL
[PHPUGPH] PHP Roadshow - MySQL[PHPUGPH] PHP Roadshow - MySQL
[PHPUGPH] PHP Roadshow - MySQL
 
SQL for interview
SQL for interviewSQL for interview
SQL for interview
 
Lab1 select statement
Lab1 select statementLab1 select statement
Lab1 select statement
 
Goldilocks and the Three MySQL Queries
Goldilocks and the Three MySQL QueriesGoldilocks and the Three MySQL Queries
Goldilocks and the Three MySQL Queries
 
Database models and DBMS languages
Database models and DBMS languagesDatabase models and DBMS languages
Database models and DBMS languages
 
lovely
lovelylovely
lovely
 
COMPUTERS SQL
COMPUTERS SQL COMPUTERS SQL
COMPUTERS SQL
 
Database COMPLETE
Database COMPLETEDatabase COMPLETE
Database COMPLETE
 
Introduction to Databases - query optimizations for MySQL
Introduction to Databases - query optimizations for MySQLIntroduction to Databases - query optimizations for MySQL
Introduction to Databases - query optimizations for MySQL
 
SQL
SQLSQL
SQL
 
SQL Server 2008 Performance Enhancements
SQL Server 2008 Performance EnhancementsSQL Server 2008 Performance Enhancements
SQL Server 2008 Performance Enhancements
 
SQL.pptx for the begineers and good know
SQL.pptx for the begineers and good knowSQL.pptx for the begineers and good know
SQL.pptx for the begineers and good know
 
My SQL Skills Killed the Server
My SQL Skills Killed the ServerMy SQL Skills Killed the Server
My SQL Skills Killed the Server
 
Sql killedserver
Sql killedserverSql killedserver
Sql killedserver
 
SQL: Structured Query Language
SQL: Structured Query LanguageSQL: Structured Query Language
SQL: Structured Query Language
 
CIS282 Midterm review
CIS282 Midterm reviewCIS282 Midterm review
CIS282 Midterm review
 
Module02
Module02Module02
Module02
 
Sql basics and DDL statements
Sql basics and DDL statementsSql basics and DDL statements
Sql basics and DDL statements
 
ADVANCE ITT BY PRASAD
ADVANCE ITT BY PRASADADVANCE ITT BY PRASAD
ADVANCE ITT BY PRASAD
 

More from Knoldus Inc.

More from Knoldus Inc. (20)

Supply chain security with Kubeclarity.pptx
Supply chain security with Kubeclarity.pptxSupply chain security with Kubeclarity.pptx
Supply chain security with Kubeclarity.pptx
 
Mastering Web Scraping with JSoup Unlocking the Secrets of HTML Parsing
Mastering Web Scraping with JSoup Unlocking the Secrets of HTML ParsingMastering Web Scraping with JSoup Unlocking the Secrets of HTML Parsing
Mastering Web Scraping with JSoup Unlocking the Secrets of HTML Parsing
 
Akka gRPC Essentials A Hands-On Introduction
Akka gRPC Essentials A Hands-On IntroductionAkka gRPC Essentials A Hands-On Introduction
Akka gRPC Essentials A Hands-On Introduction
 
Entity Core with Core Microservices.pptx
Entity Core with Core Microservices.pptxEntity Core with Core Microservices.pptx
Entity Core with Core Microservices.pptx
 
Introduction to Redis and its features.pptx
Introduction to Redis and its features.pptxIntroduction to Redis and its features.pptx
Introduction to Redis and its features.pptx
 
GraphQL with .NET Core Microservices.pdf
GraphQL with .NET Core Microservices.pdfGraphQL with .NET Core Microservices.pdf
GraphQL with .NET Core Microservices.pdf
 
NuGet Packages Presentation (DoT NeT).pptx
NuGet Packages Presentation (DoT NeT).pptxNuGet Packages Presentation (DoT NeT).pptx
NuGet Packages Presentation (DoT NeT).pptx
 
Data Quality in Test Automation Navigating the Path to Reliable Testing
Data Quality in Test Automation Navigating the Path to Reliable TestingData Quality in Test Automation Navigating the Path to Reliable Testing
Data Quality in Test Automation Navigating the Path to Reliable Testing
 
K8sGPTThe AI​ way to diagnose Kubernetes
K8sGPTThe AI​ way to diagnose KubernetesK8sGPTThe AI​ way to diagnose Kubernetes
K8sGPTThe AI​ way to diagnose Kubernetes
 
Introduction to Circle Ci Presentation.pptx
Introduction to Circle Ci Presentation.pptxIntroduction to Circle Ci Presentation.pptx
Introduction to Circle Ci Presentation.pptx
 
Robusta -Tool Presentation (DevOps).pptx
Robusta -Tool Presentation (DevOps).pptxRobusta -Tool Presentation (DevOps).pptx
Robusta -Tool Presentation (DevOps).pptx
 
Optimizing Kubernetes using GOLDILOCKS.pptx
Optimizing Kubernetes using GOLDILOCKS.pptxOptimizing Kubernetes using GOLDILOCKS.pptx
Optimizing Kubernetes using GOLDILOCKS.pptx
 
Azure Function App Exception Handling.pptx
Azure Function App Exception Handling.pptxAzure Function App Exception Handling.pptx
Azure Function App Exception Handling.pptx
 
CQRS Design Pattern Presentation (Java).pptx
CQRS Design Pattern Presentation (Java).pptxCQRS Design Pattern Presentation (Java).pptx
CQRS Design Pattern Presentation (Java).pptx
 
ETL Observability: Azure to Snowflake Presentation
ETL Observability: Azure to Snowflake PresentationETL Observability: Azure to Snowflake Presentation
ETL Observability: Azure to Snowflake Presentation
 
Scripting with K6 - Beyond the Basics Presentation
Scripting with K6 - Beyond the Basics PresentationScripting with K6 - Beyond the Basics Presentation
Scripting with K6 - Beyond the Basics Presentation
 
Getting started with dotnet core Web APIs
Getting started with dotnet core Web APIsGetting started with dotnet core Web APIs
Getting started with dotnet core Web APIs
 
Introduction To Rust part II Presentation
Introduction To Rust part II PresentationIntroduction To Rust part II Presentation
Introduction To Rust part II Presentation
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Configuring Workflows & Validators in JIRA
Configuring Workflows & Validators in JIRAConfiguring Workflows & Validators in JIRA
Configuring Workflows & Validators in JIRA
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Recently uploaded (20)

Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 

Basics on SQL queries

  • 1. Presented By: Mansi Jain Sr. Software Consultant Knoldus Inc Basics on SQL queries & Query Optimization
  • 2. Lack of etiquette and manners is a huge turn off. KnolX Etiquettes Punctuality Join the session 5 minutes prior to the session start time. We start on time and conclude on time! Feedback Make sure to submit a constructive feedback for all sessions as it is very helpful for the presenter. Silent Mode Keep your mobile devices in silent mode, feel free to move out of session in case you need to attend an urgent call. Avoid Disturbance Avoid unwanted chit chat during the session.
  • 3. Our Agenda 2 01 Query Processing in SQL 3 02 Important clauses/commands of SQL 4 03 5 04 Joins 6 05 Order Of Executions with Example 7 8 Data Definition Language 1 What is SQL ? Data Manipulation Language Query Optimization
  • 4. What is SQL ? ● SQL(Structured Query Language) is an ANSI standard language for accessing and manipulating relational databases. ● It includes database creation, deletion, fetching rows, modifying rows, etc. ● All the Relational Database Management Systems (RDMS) like MySQL, MS Access, Oracle, Sybase, Informix, Postgres and SQL Server use SQL as their standard database language. Note : Database is collection of data in the form of tables.
  • 5. Query Processing in SQL ● Each SQL query is gone through a processor where it is translated and optimized. ● Here, parser is basically translator. ● DBMS Engine is the executing engine which executes the data. ● Then, query result impacts the physical database.
  • 6. Important clauses/commands of SQL ● SELECT ● FROM ● WHERE ● GROUP BY ● HAVING ● ORDER BY ● LIMIT ● AS ● JOIN ● IN ● LIKE ● COUNT (column_name) ● SUM (column_name) ● MAX/MIN (column_name) ● AVG(column_name) ● IS NULL/ IS NOT NULL ● COMMIT ● ROLLBACK ● AND ● OR ● DISTINCT ● ON/ USING
  • 7. Data Definition Language ● CREATE - This is used to create table, database, index and view. CREATE DATABASE databasename; CREATE TABLE table_name (column1 datatype, column2 datatype,..); CREATE INDEX index_name ON table_name (column1, column2,..); CREATE VIEW view_name AS SELECT column1, column2, ... FROM table_name WHERE condition; ● ALTER - This is used to add/remove/rename/update column from table ALTER TABLE table_name ADD column_name datatype; ALTER TABLE table_name DROP COLUMN column_name; ALTER TABLE table_name RENAME COLUMN column_name; ALTER TABLE table_name DROP INDEX index_name; //MySQL Note : VIEW - Improve security of database by showing intended data to authorised user.
  • 8. Data Definition Language continue.. ● TRUNCATE - This is used to delete data inside the table, not the table itself. TRUNCATE TABLE table_name; ● DROP - This is used to delete table, database, index and view DROP DATABASE databasename; DROP TABLE table_name; DROP INDEX table_name.index_name; //SQL server DROP VIEW [view_name];
  • 9. Data Manipulation Language ● UPDATE - To modify existing data inside a table. UPDATE table_name SET column1 = value1, column2 = value2, … WHERE condition; UPDATE Students SET StudentName = 'Alfred’, City= 'Delhi' WHERE ID = 1; ● INSERT - To add single row data in to table. INSERT INTO table_name (column1, column2, column3, ...) VALUES (value1, value2, value3, ...); INSERT INTO Students (StudentName, City) VALUES ('Alfred’, 'Delhi');
  • 10. Data Manipulation Language ● DELETE - To delete specific rows in a table. Once deleted cannot be recovered. DELETE FROM table_name WHERE condition; DELETE FROM Students WHERE StudentName='Alfred'; ● SELECT - To select data from a table. SELECT column1, column2, ... FROM table_name; SELECT DISTINCT Country FROM Students;
  • 11.
  • 12. Order Of Execution with example 1. FROM - add tables names and joined them together to get base data. In this command, we can use AS to rename table for reference with alias & JOIN to add more table and ON to apply check on based on which tables will be joined. 2. WHERE - optional, to filter on resultant base data set 3. GROUP BY - after data is filter, we group rows of resultant set having same value. 4. HAVING - optional, same as Where clause, restrict rows affected by group by clause. 5. SELECT - final result is returned based on above filter clauses. 6. ORDER BY - sort the selected data, by default way of sorting is ASC, can be DESC. 7. LIMIT - restrict the result upto given no. of rows, it gives row no. from where to start and end. Example - SELECT cs.first_name, MAX(os.amount) AS OrderAmt FROM Customers AS cs JOIN Orders AS os ON cs.customer_id = os.customer_id WHERE os.order_id <4 ORDER BY os.order_id DESC GROUP by first_name (if column name is in one table only, no need for reference) HAVING MAX(Orders.amount) <=400 (optional) LIMIT 2,4 or LIMIT 2 ;
  • 13. Query Optimization Process of selecting the most effective way to carry out a SQL statement. ● Avoid Select Distinct - although handy way to remove duplicates from a query, but data may be grouped to the point of being inaccurate and Inefficient. To avoid using it, select more fields to create unique results. ● INNER JOIN V/S WHERE - WHERE works with some DBMS system which consider it as INNER JOIN but not all. This type of join (where) creates a Cartesian Join, also called a Cartesian Product or CROSS JOIN. Use INNER JOIN instead of WHERE when two or more tables are joined together to get data. ● Select required fields instead of using select * - Specify columns to avoid extra fetching load on DB. ● Use Limit to sample query results- always fetch limited data to decrease response time of a query. ● Use wildcards at the end of a phrase only- as they search the entire database for matching results. ● Use Indexing: Ensure proper indexing for quick access to the database. ● Avoid using clauses like Initcap, Lower, Upper - as they increase the query response time.