## SQL BETWEEN Operator With Example

The SQL BETWEEN operator is used to fetch records between a given range. For example, Let’s say, we want to retrieve all books within a given prince range \$90 to \$400 from a BOOKS table. Another example we can take as we want to list all employees whose salary is between \$5000 to \$10000. or … Read more SQL BETWEEN Operator With Example

Categories SQL

## 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 IN Operator

SQL IN operator is used to check if a value is present in a given list a result list returned by sub quarries. For example, Lest say, BOOKS table contains books written by different authors named from A to Z. We want to retrieve list of books written by only 3 authors e.g. A, B … Read more SQL IN Operator

Categories SQL

## SQL Logical Operators – AND | OR | NOT

Example of using SQL Logical operators viz AND, OR and NOT. Logical operators are used to test two or more conditions in an SQL Select statements, update and delete statements with WHERE condition. SQL AND Operator If all two or more conditions are true only then select, update or delete can be performed on data. … Read more SQL Logical Operators – AND | OR | NOT

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 WHERE Clause

SQL where clause with query example – Where clause in SQL is used to fetch records on the basis of some condition. For example, List the books whose cost is greater than 400. Delete the book whose price is less than 100. Update the book value price where the price is equal to 500 etc. … Read more SQL WHERE 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