SQL NOT IN

The NOT IN operator checks a value within a set of values, and retrieve the rows from the table which are NOT matching. This is opposite of SQL IN operator. SQL NOT IN Syntax [Expression] NOT IN (value1,value2,value3…..); Example: Get the list from the Books table where the AUTHORSLASTNAME is not  ‘kalka’ ,  ‘MEYER’ ,  … Read more SQL NOT IN

Categories SQL

SQL HAVING Clause

SQL HAVING Clause –  Having clause is used to retrieve records on the basis of some condition. It is same like SQL WHERE Clause except that the having clause can be used with Aggregate functions like SUM, AVG and Count etc.  POINTS: HAVING condition can restrict the data that results using group by clause. Aggregate … Read more SQL HAVING Clause

Categories SQL

SQL GROUP BY

SQL GROUP BY clause with query example – Group By statement is used to group the common data in result set. For example, We have multiple books with genera as below Book 1 – classic Book2 – romance Book 3 – classic So, If we want to count number of books with same genera, then … Read more SQL GROUP BY

Categories SQL

SQL ORDER BY

SQL ORDER BY clause with query example – Order By clause is used to sort the data either in ascending order or in descending order based on the specified column name or column number. For example, You may want to sort all books from a BOOKS table based on ISBN NO in ascending order. Or, … Read more SQL ORDER BY

Categories SQL

SQL DISTINCT

SQL Distinct statements with query example – Distinct statements in SQL is used to retrieve unique / different records from a column. It can return records from single or multiple columns both. POINTS: Remove the duplicate records from the result set. It is used with only SQL SELECT Statement. Distinct always retrieves first value from … Read more SQL DISTINCT

Categories SQL

SQL AVG Function

SQL AVG Function with query example – Avg function returns Average of all values of a column or expression. AVG function returns the average value of an expression. AVG function returns NULL If find no matching row exists. Distinct key word can be used to return the average of the distinct values.   SQL AVG … Read more SQL AVG Function

Categories SQL