SQL

SQL (Structured Query Language) is a standard language used to operate relational databases. It includes operations such as database creation, retrieving and modifying data, granting privileges to data.

Thumbnail image for INNER JOIN and OUTER JOIN Explained

INNER JOIN and OUTER JOIN Explained

Overview of INNER JOIN and OUTER JOIN in Oracle, with examples, memory aids and a further drilldown of INNER JOIN and OUTER JOIN types.

Read the Full Article →
Thumbnail image for Grant SELECT on V$ Views

Grant SELECT on V$ Views

Grant SELECT on V$ views to allow non-admin database users to query SYS-owned V$ views (dynamic performance views) such as V$INSTANCE or V$SESSION.

Read the Full Article →
Thumbnail image for How to Find out Your Oracle Database Version

How to Find out Your Oracle Database Version

Three ways to find out your Oracle database version in SQL and PL/SQL: using V$VERSION, V$INSTANCE, or DBMS_DB_VERSION constants.

Read the Full Article →
Thumbnail image for UNPIVOT in Oracle 11G to Select Columns As Rows

UNPIVOT in Oracle 11G to Select Columns As Rows

You can easily transpose table columns to rows in Oracle 11G+ using the UNPIVOT clause is SQL. A comparison of the pre-11G DECODE solution with the 11G+ UNPIVOT method.

Read the Full Article →
Thumbnail image for SQL to Select Rows Conditionally Based On Column Value

SQL to Select Rows Conditionally Based On Column Value

SQL solution to select rows conditionally based on column value – for example, a priority column tagged to a set of rows, with a requirement to select only the rows with top priority.

Read the Full Article →
Thumbnail image for SQL to Find Master Records with Identical Detail Records

SQL to Find Master Records with Identical Detail Records

SQL to find those records in the master table that have identical detail records in a child table.

Read the Full Article →
Thumbnail image for Replace Duplicates in ID Column with Unique Values

Replace Duplicates in ID Column with Unique Values

A solution to the requirement of replacing only the duplicate IDs with unique values in a database table, and letting everything else stay untouched.

Read the Full Article →
Thumbnail image for The Curious Case of The Missing ORA-00904

The Curious Case of The Missing ORA-00904

What’s worse than an error that shows up when you don’t expect it? An error that does NOT show up when you totally expect it. Witness “ORA-00904: invalid identifier” playing truant.

Read the Full Article →
Hierarchical Data in a Relational Table

Flatten Hierarchical Data using a Single SQL

Single Oracle SQL to find and flatten hierarchical data stored in a table, using a combination of SYS_CONNECT_BY_PATH and regular expressions.

Read the Full Article →
Thumbnail image for LISTAGG for Converting Rows to Comma-Separated String

LISTAGG for Converting Rows to Comma-Separated String

Oracle built-in function LISTAGG lets you concatenate multiple rows of data into a single delimiter-separated string. No more of those circuitous MAX(SYS_CONNECT_BY_PATH) or STRAGG solutions of the pre-Oracle 11G R2 days!

Read the Full Article →