SQL

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 […]

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’ ,  ‘AUSTEN’. […]

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 […]

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: SQL HAVING Clause Syntax SELECT [column_1], [column_2]……………….,aggregate_function[Column_n]FROM [table_name][WHERE  CONDITIONS]GROUP BY [column_1],[column_2]…………..[Column_n][ HAVING [CONDITIONS]]; […]

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. […]

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 – classicBook2 – romanceBook 3 – classic So, If we want to count number of books with same genera, then we can use […]

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, […]

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: SQL Distinct Syntax: SQL Distinct syntax to get unique data by removing duplicate data from result set. The distinct query we can […]

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 Function […]

Scroll to top