Skip to main content

Posts

Non-Equijoins and Self-Joins in Oracle SQL

Non-Equijoins and Self-Joins in Oracle SQL Non-Equijoins and Self-Joins in Oracle SQL: Complete Guide Most joins in SQL use the equality operator. However, many real-world business requirements demand joining tables using conditions other than equality. This comprehensive guide covers two advanced and powerful join techniques: Non-Equijoins and Self-Joins . Learning Objectives By the end of this guide you will be able to write Non-Equijoins using range operators, perform Self-Joins for hierarchical data, understand performance implications, avoid common mistakes, and apply best practices in real Oracle environments. 1. Understanding Non-Equijoins A Non-Equijoin is a join that uses a comparison operator other than the equals sign. This includes > , < , >= , <= , BETWEEN , and <> . When Should You Use Non-Equijoins? Non-Equijoins are required when relationships between data are based on ranges rather than exact matches. Common business scenarios ...
Recent posts

Oracle SQL Implicit Conversion and ROWNUM Explained

Oracle SQL Implicit Conversion and ROWNUM Explained Oracle SQL: Implicit Conversion and ROWNUM Explained Oracle SQL is very flexible, but this flexibility can sometimes lead to unexpected results. Two areas where developers often face surprises are Implicit Conversion and ROWNUM . This guide explains both concepts clearly with practical examples. 1. Implicit Conversion in Oracle SQL Oracle automatically converts data types when it can. This is called implicit conversion . While convenient, it can cause performance problems and incorrect results if not understood properly. Common Implicit Conversion Scenarios Example 1: VARCHAR2 to NUMBER CREATE TABLE employees ( emp_id VARCHAR2(10), salary NUMBER ); -- This works because Oracle converts '101' to number SELECT * FROM employees WHERE emp_id = 101; Oracle converts the string '101' to number 101 to compare with the column. However, this can prevent index usage in some cases. Example ...

Oracle SQL Relational Database Concepts: Tables, Keys and Relationships

Oracle SQL: Relational Database Concepts Explained Oracle SQL: Relational Database Concepts Explained Relational databases are the foundation of modern data management systems. Oracle Database, being one of the most powerful and widely used relational database management systems in the world, is built entirely on relational database principles. If you want to truly master Oracle SQL, you must first develop a strong understanding of these fundamental concepts. In this detailed guide, we will explore every important concept step by step with clear explanations, realistic tables, practical Oracle SQL examples, diagrams, and best practices. By the end of this article, you will have a solid foundation to design efficient databases and write better SQL queries. 1. What is a Relational Database? A relational database is a type of database that stores and organizes data in the form of tables. These tables are connected to each other through well-defined relationships. The term...

Oracle SQL MERGE Statement and Advanced DML Patterns — 1Z0-071 Exam Guide

1Z0-071 Exam Prep Chapters 18 & 19 Volume 4 Chapters 18 and 19 cover the more advanced DML patterns on the exam. MERGE is the centrepiece — it combines INSERT and UPDATE into a single statement and the exam tests every clause of its syntax. The other patterns covered here include DEFAULT values in DML, explicit DEFAULT keyword usage, and the behaviour of multi-row DML with constraints. MERGE questions are not common in high numbers but when they appear, candidates who have not studied the syntax carefully tend to choose plausible-looking wrong answers. In this post MERGE — the combined INSERT/UPDATE statement MERGE full syntax MERGE with WHEN NOT MATCHED MERGE with WHEN MATCHED — optional DELETE Making WHEN clauses optional DEFAULT values in INSERT and UPDATE Explicit DEFAULT keyword in DML DEFAULT with NULL — important distinction Multi-row DML and constraint checking Quick reference Practice questi...

Oracle SQL Advanced Subqueries: Scalar, WITH Clause and DML Subqueries — 1Z0-071 Exam Guide

1Z0-071 Exam Prep Chapters 16 & 17 Volume 4 Advanced subqueries build on the basic subquery patterns from Chapter 8. Chapters 16 and 17 go deeper — scalar subqueries in unexpected places, the WITH clause for reusable query blocks, and subqueries used as the target of INSERT, UPDATE, and DELETE statements. These are not the most common exam questions, but they do appear — and candidates who haven't studied them lose marks that are relatively easy to pick up. In this post Scalar subqueries — one value in unexpected places Scalar subquery in SELECT list Scalar subquery in ORDER BY Multiple-column subqueries Pairwise vs non-pairwise comparison The WITH clause — named query blocks Subqueries as DML targets — UPDATE with subquery INSERT into a subquery target DELETE using a subquery Quick reference Practice questions 01 — Scalar subqueries — one value in unexpected places A scalar subquery re...