ORACLE: Limit Returned records with rownum

The following query will get the latest entered_on date from the result table.   — This select will get the latest result entered_on date — to check after a refresh what’s the latest data — SELECT * FROM ( your_query_here ) WHERE ROWNUM <= N. select * from (select entered_on from result where trim(entered_on) is […]

SQLite: select certain # of records

A column name can be any of the names defined in the CREATE TABLE statement or one of the following special identifiers: “ROWID”, “OID”, or “_ROWID_”. These special identifiers all describe the unique integer key (the rowid) associated with every row of every table. The special identifiers only refer to the row key if the […]

Oracle SQL: Escape in LIKE clause

The underscore in oracle SQL, when it’s used in LIKE clause represent a one character wild card. For example: like ‘V_KAA’ (returns VaKAA, VbKAA) But you want to find something like V_KAAA (including a under score_), you would need to escape the _ character in like clause. For example: select * from table where ID […]

Oracle: get detail table information

You can use SQL*Plus to provide the following details about a table: 1. Column Details 2. PRIMARY KEY 3. INDEXES 4. FOREIGN KEYS 5. CONSTRAINTS 6. ROWCOUNT 7. Other Tables That REFER to this Table 8. PARTITIONED COLUMNS 9. PARTITIONS 10. TRIGGERS 11. DEPENDANTS The following SQL Script can provide this information: SET AUTOTRACE OFF […]