Loading topic
WHERE conditions. They look simple, but data types, character sets, and NULL change what they do. This chapter assumes you can write a basic SELECT ... FROM ... WHERE and know the common data types (VARCHAR2, NUMBER, DATE). The examples use the HR 5 min readAND, OR and NOT, how precedence decides the result, and how NULL changes the outcome.6 min readSELECT ... FROM ... WHERE query and know the comparison operators =, <>, < and >=. It also assumes you know the basic data types (VARCHAR2, NUMBER, DATE) and that you have an Oracle session with the HR sample schema. The examples use the `em5 min readSELECT ... FROM ... WHERE query and that you know the VARCHAR2, NUMBER and DATE types. It uses the HR sample schema. By the end you should be able to test for NULL correctly. You should also be able to predict what a condition returns when NULL is involve6 min readWHERE clause with comparison operators, AND/OR, BETWEEN and LIKE, and that you know what NULL means in a comparison. The examples use the HR sample schema. Dates and text look simple, but each hides a trap that returns wrong rows without raising an er5 min readSELECT statement. That order explains most "why can't I use this here?" errors. It also explains why ROWNUM and ORDER BY interact badly.5 min readORDER BY works in Oracle SQL, where it sits in query evaluation, and the errors it most often causes. It assumes you can write a basic SELECT ... FROM ... WHERE query and know the VARCHAR2, NUMBER and DATE types. The examples use the HR sample schema (employees, `6 min readORDER BY item can be written and how Oracle resolves each one. It assumes you can write a basic SELECT ... FROM ... WHERE query and have met single-column ORDER BY ... ASC | DESC. The examples use the HR sample schema. Where NULLs land in the sort is covered i6 min readORDER BY, know that a NULL means "no value" rather than zero or an empty string, and can run queries against the HR sample schema. It covers the default position of NULL in a sorted result, how to override it, and the problems that appear when you com6 min readSELECT, filter with WHERE, and sort with ORDER BY on one or more keys, including NULLS FIRST and NULLS LAST. It uses the HR sample schema. The row limiting clause needs Oracle Database 12c Release 1 or later. On older releases, see the next chapte6 min readSELECT with WHERE and ORDER BY, and that you know what an inline view (a subquery in the FROM clause) is. It also assumes you have seen FETCH FIRST and OFFSET from the previous chapter. All examples use the HR sample schema.6 min readORDER BY with multiple keys and NULLS FIRST/LAST. It also assumes you know that WHERE filters rows before sorting. You need an Oracle database and a client such as SQL*Plus, SQL Developer or SQLcl. The examples use only DUAL and the HR employees table.5 min read