FAQ

Frequently asked questions about the Oracle database, SQL and PL/SQL.

Thumbnail image for The Difference between CHAR, VARCHAR and VARCHAR2

The Difference between CHAR, VARCHAR and VARCHAR2

Oracle has three datatypes to store strings. – CHAR, VARCHAR and VARCHAR2. How do they differ from each other? When should you use which? This article gives you the lowdown on the subject.

Read the Full Article →
Thumbnail image for IN = EXISTS, but beware: NOT IN is not the same as NOT EXISTS!

IN = EXISTS, but beware: NOT IN is not the same as NOT EXISTS!

In Oracle SQL queries, IN and EXISTS are interchangeable. Many of us assume therefore, that NOT IN and NOT EXISTS are also interchangeable. That’s not the case though.

Read the Full Article →
Thumbnail image for Which is faster – IN or EXISTS?

Which is faster – IN or EXISTS?

A question asked multiple times over on Oracle forums: Which is faster – IN or EXISTS? The short answer, post-Oracle 9i is: Both are pretty much the same!

Read the Full Article →
Thumbnail image for Select Rows With Max Value

Select Rows With Max Value

Solution for selecting rows based on the maximum value of a specific table column, such as date. See it in action: script to list the latest order details of every customer’s orders.

Read the Full Article →
Thumbnail image for The Difference Between DECODE and CASE

The Difference Between DECODE and CASE

Both DECODE and CASE statements in Oracle are used for IF-THEN-ELSE conditional operations, but there are distinct differences in their power and behavior.

Read the Full Article →
Thumbnail image for Selecting ODD or EVEN rows from a table

Selecting ODD or EVEN rows from a table

Question: How can I select only the even/odd rows from an Oracle table? Answer: Talking of “even or odd rows” is meaningless in Oracle until you have ordered the rows.

Read the Full Article →
Thumbnail image for The Fallacy of Interview Questions

The Fallacy of Interview Questions

When you are starting out preparing for Oracle interviews, you might imagine that learning answers to lists of interview questions is the way to get a decent job. This article shows you why this is the wrong way to go about it, and suggests what to do instead.

Read the Full Article →
Thumbnail image for The Difference between DELETE, TRUNCATE and DROP

The Difference between DELETE, TRUNCATE and DROP

DELETE, TRUNCATE and DROP – all three commands get rid of table data. How exactly are they different? When should you use which?

Read the Full Article →
Thumbnail image for Nth Highest Salary in Oracle

Nth Highest Salary in Oracle

“How can I select the Nth highest salary of the EMP table?” The answer to the problem of finding the Nth highest salary. You can extend this logic to find the Nth highest row of any table.

Read the Full Article →
Thumbnail image for 6 Reasons Why You Should Use PL/SQL Packages

6 Reasons Why You Should Use PL/SQL Packages

When stored procedures/functions can exist standalone, why have packages at all? This article tells you the benefits of using PL/SQL packages.

Read the Full Article →