SQL - SPLessons

SQL Best Practices

Chapter 52

SPLessons 5 Steps, 3 Clicks
5 Steps - 3 Clicks

SQL Best Practices

SQL Best Practices

shape Description

SQL is utilized to recover information from database and overseeing information into the database. The DBMS forms the SQL ask for and recovers the fancied yield. SQL includes creating the database, modifying the database, deleting the database, retrieving the rows and column values. Client can compose SQL script to execute and SQL compiler consequently creates a method to get to database and convey the craved yield.

shape Examples

Describes a sample example for SQL program.

SELECT dept_num, avg(marks)FROM student_details

GROUP BY dept_num

HAVING dept_num IN ('D101', 'D103', 'D102')  ;

This is can be written in a better way like

SELECT dept_num, avg(marks) FROM student_details WHERE dept_num IN ('D101', 'D103', 'D102'); 
GROUP BY dept_num

In HAVING clause good to use aggregate functions.

Summary

shape Key Points

SQL Best Practices – Describes some sample examples related to the SQL Database.