In this video of code decode we have demonstrate how to optimize and fine tuned the SQL queries
asked in Sql interview question and answers
Udemy Course of Code Decode on Microservice k8s AWS CICD link:
https://openinapp.co/udemycourse
Course Description Video :
https://yt.openinapp.co/dmjvd
This video has Best Practices of SQL and Ways to fine tune your SQL Queries
SELECT fields instead of using SELECT *
Avoid SELECT DISTINCT
Create joins with INNER JOIN (not WHERE)
Use WHERE instead of HAVING to define filters
Avoid too much JOINs on your query: use only what is necessary!
Avoid cursors at all costs!
SELECT DISTINCT is a handy way to remove duplicates from a query. SELECT DISTINCT works by GROUPing all fields in the query to create distinct results. To accomplish this goal however, a large amount of processing power is required. Additionally, data may be grouped to the point of being inaccurate. To avoid using SELECT DISTINCT, select more fields to create unique results.
Some SQL developers prefer to make joins with WHERE clausesThis type of join creates a Cartesian Join, also called a Cartesian Product or CROSS JOIN.
In a Cartesian Join, all possible combinations of the variables are created
This is an inefficient use of database resources, as the database has done 100x more work than required. Cartesian Joins are especially problematic in large-scale databases, because a Cartesian Join of two large tables could create billions or trillions of results.
To prevent creating a Cartesian Join, use INNER JOIN instead:
Most Asked Core Java Interview Questions and Answers : • Core Java frequently asked Interview Quest...
Advance Java Interview Questions and Answers : • Advance Java Interview Questions
Java 8 Interview Questions and Answers : • Java 8 Interview Questions(New Features)
Hibernate Interview Questions and Answers : • Hibernate Interview Questions Java
Spring Boot Interview Questions and Answers : • Advance Java Interview Questions
Angular Playlist : • Angular Course Introduction || Angular 8
SQL Playlist : • SQL Interview Questions and Answers
GIT : • GIT
Subscriber and Follow Code Decode
Subscriber Code Decode : https://www.youtube.com/c/CodeDecode?...
Linkedin : / codedecodeyoutube
Instagram : / codedecode25
#sqlinterviewQuestions
#sqlbestpractices
#sqlfinetuning