-- Regex replace
UPDATE TABLE T SET T.FIELD = REGEXP_REPLACE (T.FIELD, 'Search', 'Replace')
-- Update based on another table
UPDATE COMPOUND_INVENTORY t
SET T.PUBCHEM_CID = (
SELECT C.PUBCHEM_CID
FROM COMPOUND C
WHERE T.CID = C.CID)
-- Check for missing against another table
SELECT L.CID
FROM COMPOUND L
LEFT JOIN COMPOUND_INVENTORY I ON L.CID = I.CID
WHERE I.CID IS NULL
-- Count repeats
SELECT col,
COUNT(dupe_col) AS dupe_cnt
FROM TABLE
GROUP BY col
HAVING COUNT(dupe_col) > 1
ORDER BY COUNT(dupe_col) DESC
-- Select row range
SELECT *
FROM (SELECT T1.*, ROWNUM AS ROWNUMBER
FROM COMPONENT_LIBRARY T1)
WHERE ROWNUMBER BETWEEN 10 AND 18
-- Create database link
CREATE DATABASE LINK UADEVORADB
CONNECT TO user IDENTIFIED BY password
USING '(DESCRIPTION=
(ADDRESS=(PROTOCOL=TCP)(HOST=uadevorahost1)(PORT=1521))
(CONNECT_DATA=(SERVICE_NAME=uadevoradb.domaindb)))'