Latest Event Updates

Self-Joins Using the ON Clause

Posted on Updated on

Related imageSelf-Joins Using the ON Clause

 

Employee table may have a SupervisorID column that points to the employee that is the boss of the current employee. It’s basically used where there is any relationship between rows stored in the same table. SQL selfjoin simply is a normal join which is used to join a table to itself. 

Example: Read the rest of this entry »

Types of Joins

Posted on Updated on

Image result for sqlTypes of Joins

As per SQL concern and advancement, there are 3-types of joins and all RDBMS joins can be achvied using these types of joins.
  • INNER-JOIN: It merges(or combiens) matched rows from two tables. …
  • **OUTER-JOIN:**It merges(or combines) matched rows from two tables and unmatched rows with NULL values.

Read the rest of this entry »

Restricting Group

Posted on Updated on

Image result for sqlRestricting Group

Results with the HAVING Clause

The GROUP BY Clause is used together with the SQL SELECT statement. The SELECT statement used in the GROUP BY clause can only be used contain column names, aggregate functions, constants and expressions. The HAVING clause is used to restrict the results returned by the GROUP BY clause. Read the rest of this entry »

Group Functions and Null Values

Posted on Updated on

Related imageGroup Functions and Null Values

According to the SQL Reference Manual section on Aggregate Functions: All aggregate functions except COUNT(*) and GROUPING ignore nulls. You can use the NVL function in the argument to an aggregate function to substitute a value for a null. COUNT never returns null, but returns either a number or zero.

Group functions ignore null values in the column.

You can divide rows in a table into smaller groups by using the GROUP BY clause. Read the rest of this entry »

SQL AVG()

Posted on Updated on

Image result for functionSQL AVG()

  • The AVG() Function. The AVG() function returns the average value of a numeric column. SQL AVG() Syntax. …
  • Demo Database. In this tutorial we will use the well-known Northwind sample database. …
  • SQL AVG() Example. The following SQL statement gets the average value of the “Price” column from the “Products” table.

Read the rest of this entry »

Group Functions?

Posted on Updated on

Image result for function wordWhat Are Group Functions?

Group functions are built-in SQL functions that operate on groups of rows and return one value for the entire group. These functions are: COUNT, MAX, MIN, AVG, SUM, DISTINCT. SQL COUNT (): This function returns the number of rows in the table that satisfies the condition specified in the WHERE condition.

Group functions operate on sets of rows to give one result per group. Read the rest of this entry »

DECODE Function

Posted on Updated on

Image result for DECODE Function in SQLDECODE Function

In a DECODE function, Oracle considers two nulls to be equivalent. If expr is null, then Oracle returns the result of the first search that is also null.

Facilitates conditional inquiries by doing the work of a CASE expression or an IF-THEN-ELSE statement.

Read the rest of this entry »

COALESCE Function

Posted on Updated on

Using the COALESCE Function

In the example above, if any of the “UnitsOnOrder” values are NULL, the result is NULL. Microsoft’s ISNULL() function is used to specify how we want to treat NULL values. The NVL(), IFNULL(), and COALESCE() functions can also be used to achieve the same result.

• The advantage of the COALESCE function over theNVL function is that the COALESCE function cantake multiple alternate values.

• If the first expression is not null, the COALESCE function returns that expression; otherwise, it does a COALESCE of the remaining expressions. Read the rest of this entry »

Posted on Updated on

Using the NVL2 Function:

·         If expr1 is not null, NVL2 returns expr2. If expr1 is null, NVL2 returns expr3. The argument expr1 can have any data type.

Read the rest of this entry »