23EAC382 · DATABASE MANAGEMENT SYSTEMS LAB

Learn Oracle SQL the Claude way — calm, complete, exam-ready.

One page covering Expt 1 → 6 exactly in your lab's Oracle style (SELECT … FROM DUAL;), with every syntax corrected for the system exam. Type in the search bar and the page filters itself. Every code block has a copy button.

Style: Oracle / SQL*Plus System Qs: write query → show output → explain Deploy: single file → Cloudflare Pages Coverage: 6 expts · 70+ queries
BEFORE ANYTHING · 2 MINUTES

How the system exam works

You get a machine with Oracle. You type a query, run it, show output, explain it. These 5 facts decide pass/fail.

FactWhat to do
1. Every statement ends with ;Without it Oracle waits. Always type SELECT … ;
2. DUAL is a dummy table1 row, 1 column. Use it when you have no table: SELECT 2+2 FROM DUAL;
3. Strings are case-sensitive'ranga' = 'RANGA' is FALSE. Your Expt 4 Q9 proves this.
4. Dates need TO_DATETO_DATE('15-05-1990','DD-MM-YYYY') — never insert '15-05-1990' bare.
5. NULL is not zero / blankNever = NULL. Only IS NULL / IS NOT NULL.
Memorise these 3 lines — they answer Expt 6 Q2–Q5
-- the dummy table
DESC DUAL;
SELECT COUNT(*) FROM DUAL;  -- answer is always 1
SELECT 'If you want to know what a man is like…' FROM DUAL;
SELECT SYSDATE FROM DUAL;  -- today's date; also works FROM any table
Viva trap: “Can you get SYSDATE from your own table?” Yes — SELECT SYSDATE FROM employee_book; repeats the date once per row. DUAL just gives it once.
EXPERIMENT 1 · FOUNDATION

Create, alter, add & modify data

Everything else stands on this. If you can build a table and change it, you can do Expts 2–6.

1A · Data types you actually use

TypeUseExample
NUMBER(p) / NUMBER(p,s)integers / decimalsid NUMBER(3), salary NUMBER(8,2)
VARCHAR2(n)text (use this, not VARCHAR)emp_name VARCHAR2(20)
DATEdatesdob DATE

1B · CREATE — build the table (Expt 2 Q1 / Expt 3 Q1 / Expt 6 Q1 pattern)

Template — copy and change names
CREATE TABLE employee_details (
  id        NUMBER(3),
  emp_name  VARCHAR2(20),
  age       NUMBER(3),
  city      VARCHAR2(20),
  salary    NUMBER(8,2)
);
Expt 6 style with dates
CREATE TABLE employee_book (
  employee_id      NUMBER(10),
  employee_name    VARCHAR2(20),
  dob              DATE,
  date_of_joining  DATE,
  employee_salary  NUMBER(10)
);

1C · INSERT — add rows

INSERT INTO employee_details VALUES (101, 'Arun', 25, 'Kurnool', 7500);
INSERT INTO employee_book VALUES (101, 'Arun Kumar', TO_DATE('15-05-1990','DD-MM-YYYY'), TO_DATE('10-06-2018','DD-MM-YYYY'), 75000);
-- check what you did
SELECT * FROM employee_details;

1D · ALTER — change the structure after creation

-- add a column
ALTER TABLE employee_details ADD (email VARCHAR2(30));
-- change size / type
ALTER TABLE employee_details MODIFY (city VARCHAR2(30));
-- rename a column (Oracle)
ALTER TABLE employee_details RENAME COLUMN city TO work_city;
-- drop a column
ALTER TABLE employee_details DROP COLUMN email;

1E · UPDATE / DELETE / TRUNCATE / DROP — change data vs destroy

-- Expt 2 Q13 pattern: change salary 8500 → 9000 for id 5
UPDATE employee SET salary = 9000 WHERE id = 5;
-- DANGER: no WHERE = every row changes. Always write WHERE first.
DELETE FROM employee_details WHERE id = 105;   -- removes rows, keeps table
TRUNCATE TABLE employee_details;  -- removes ALL rows fast, keeps table
DROP TABLE employee_details;      -- deletes table itself
DESC employee_details;  -- describe structure anytime
Most failed system question: forgetting WHERE in UPDATE/DELETE. Examiners deliberately watch for it. Say out loud: “WHERE id = … so only one row changes.”
EXPERIMENT 2 · FILTERING

Comparison, BETWEEN, IN, LIKE, NULL

All on table EMPLOYEE(id, name, age, address, salary). Every query is SELECT * FROM employee WHERE …

2A · Comparison — salary filters (Q2)

SELECT * FROM employee WHERE salary > 6000;
-- all six: =  !=  <>  >  <  >=  <=   (!= and <> both mean not-equal)

2B · BETWEEN — a range, inclusive (Q3–Q4)

SELECT * FROM employee WHERE salary BETWEEN 2000 AND 9000;
SELECT * FROM employee WHERE salary NOT BETWEEN 2000 AND 9000;
-- BETWEEN includes both ends. NOT BETWEEN = outside the range.
Your PDF prints 2000–9000 in the question but 6000–15000 in the code — same syntax, just numbers. In the exam, read the question's numbers, not your memory.

2C · LIKE — pattern matching (Q5–Q8). The most-asked block.

PatternMeansLab example (fixed)
%any characters (incl. none)name LIKE 'K%' → starts with K
_exactly one characteraddress LIKE '_____' → exactly 5 chars (Q8)
%i / %gends withaddress LIKE '%i' → ends with i (Q6)
%a%containsname LIKE '%a%' → contains a (Q7)
SELECT * FROM employee WHERE name LIKE 'K%';     -- starts with K (Q5; PDF wrongly shows p%)
SELECT * FROM employee WHERE address LIKE '%i';  -- ends with i
SELECT * FROM employee WHERE name LIKE '%a%';   -- contains a (use %a%, not _a%)
SELECT * FROM employee WHERE address LIKE '_____'; -- exactly 5 chars = 5 underscores
SELECT * FROM employee_details WHERE emp_name NOT LIKE 'B%'; -- Expt 3 Q15

2D · NULL — the only correct syntax (Q9–Q10)

SELECT * FROM employee WHERE salary IS NULL;
SELECT * FROM employee WHERE salary IS NOT NULL;
-- WRONG: WHERE salary = NULL  (never returns rows)

2E · IN — list membership (Q11–Q12)

SELECT * FROM employee WHERE age IN (20, 25);
SELECT * FROM employee WHERE age NOT IN (20, 25);
-- same as: WHERE age = 20 OR age = 25
EXPERIMENT 3 · LOGIC + PRESENTATION

AND / OR / NOT, aliases, ORDER BY, concatenation, arithmetic

Table EMPLOYEE_DETAILS(id, emp_name, age, city, salary). This experiment is about combining conditions and formatting output.

3A · Logical operators (Q2–Q4)

SELECT * FROM employee_details WHERE age = 25 AND city = 'kurnool';
SELECT * FROM employee_details WHERE age = 25 OR city = 'bangalore';
SELECT * FROM employee_details WHERE age != 25;  -- also: <>  or  NOT (age = 25)
AND needs both true. OR needs one. Strings must match case exactly: 'kurnool' ≠ 'Kurnool'.

3B · Aliases — rename output columns (Q5–Q6, Q11–Q12)

SELECT id, emp_name, salary, salary * 1.1 AS "expected salary" FROM employee_details;
SELECT id, emp_name, 60 - age AS "retirement years" FROM employee_details;
SELECT id, emp_name, salary, salary * 0.75 AS "salary after cut" FROM employee_details;
-- quotes needed only when alias has a space. AS is optional but use it.

3C · Arithmetic in SELECT (Q5–Q6, Q11–Q14, Expt 6 Q3/Q6)

SELECT 100 * 20 + 40 - 200 FROM DUAL;              -- 1840, normal maths priority
SELECT (((200+350) - (30+30)) * 1.5) / 2 FROM DUAL;  -- Expt 6 Q6 = 367.5
SELECT +3 FROM DUAL;  -- unary plus = 3
SELECT -3 FROM DUAL;  -- unary minus = -3
-- salary maths:
SELECT salary * 1.1 AS "10% hike", salary * 1.05 AS "5% hike", salary * 0.75 AS "25% cut" FROM employee_details;

3D · ORDER BY (Q7–Q8)

SELECT * FROM employee_details ORDER BY salary;          -- ascending = default
SELECT * FROM employee_details ORDER BY salary ASC;
SELECT * FROM employee_details ORDER BY age DESC;      -- descending

3E · Concatenation — the corrected version (Q9)

Your PDF's CONCAT is wrong for Oracle. Oracle's CONCAT() takes only 2 arguments. For sentences use ||. Both forms below are correct:
-- CORRECT Oracle way (use this in exam):
SELECT 'The employee name is ' || emp_name || ' and his age is ' || age || ' from ' || city || ' getting Rs ' || salary FROM employee_details;
-- CONCAT only joins 2 strings, so nest it:
SELECT CONCAT(CONCAT('The employee name is ', emp_name), ' ...') FROM DUAL;

3F · SYSDATE (Q10)

SELECT SYSDATE AS "Today's Date" FROM DUAL;
EXPERIMENT 4 · SETS + CASE

UNION, INTERSECT, MINUS and UPPER / LOWER / INITCAP

Tables cricket_players / football_players / basketball_players(player_id, player_name, section). Set operators stack result sets vertically.

4A · The three set operators — one mental model

OperatorKeepsDuplicates?
UNIONeverything from bothremoves duplicates, sorts
UNION ALLeverything from bothkeeps duplicates, faster
INTERSECTonly common rows
MINUSrows in first but not seconddirection matters
SELECT * FROM cricket_players UNION SELECT * FROM football_players;
SELECT * FROM cricket_players UNION ALL SELECT * FROM football_players;
SELECT * FROM cricket_players UNION SELECT * FROM football_players UNION SELECT * FROM basketball_players;
SELECT * FROM basketball_players INTERSECT SELECT * FROM football_players;
SELECT * FROM football_players MINUS SELECT * FROM cricket_players;
Q4 error demo (must know): SELECT player_id, player_name FROM cricket_players UNION SELECT * FROM basketball_players fails — column counts differ (2 vs 3). Rule: same number of columns, compatible types, in same order.

4B · Case functions (Q7–Q15)

SELECT UPPER('all is well') FROM DUAL;                                        -- ALL IS WELL
SELECT UPPER('The way to get started…') FROM DUAL;                  -- ALL CAPS
SELECT UPPER(player_name) FROM football_players;                     -- Q10: whole column
SELECT LOWER('THE ONLY REAL MISTAKE…') FROM DUAL;                  -- all small
SELECT LOWER(player_name) FROM football_players;                     -- Q14
SELECT INITCAP('every man dies, not every man lives') FROM DUAL;  -- Every Man Dies, Not Every Man Lives
Q9 inference to speak in viva: WHERE player_name = 'ranga' finds the row; = 'RANGA' finds nothing — Oracle string comparison is case-sensitive. Fix by comparing UPPER(player_name) = 'RANGA'.
EXPERIMENT 5 · CHARACTER MANIPULATION

INSTR, SUBSTR, LPAD, RPAD, TRIM, REPLACE

Highest marks-per-line experiment. Every function below appeared verbatim in your assignment.

5A · INSTR — find position (Q1–Q4)

Template: INSTR(string, search, start_position, occurrence). Returns 0 (not NULL) when not found. Case-sensitive.

SELECT INSTR('Nothing is impossible', 't', 1, 1) FROM DUAL;   -- Q1: first 't'
SELECT INSTR('Nothing is impossible', 'b', -1, 1) FROM DUAL;  -- Q2: search backwards: use -1 start
SELECT INSTR('Nothing is impossible', 'z', 1, 1) FROM DUAL;   -- Q3: 0 = not found
SELECT INSTR('Nothing is impossible', 'I', 1, 1) FROM DUAL;   -- Q4: capital I only

5B · SUBSTR — cut out text (Q5–Q6)

Template: SUBSTR(string, start, length). Position 1 = first character.

SELECT SUBSTR('A picture is worth a thousand words', 14, 5) FROM DUAL;  -- 'worth' (w is 14th char; PDF's 13,6 gives ' worth' with space)
SELECT SUBSTR('A picture is worth a thousand words', 1000, 6) FROM DUAL; -- NULL: past the end
Count trick: “A picture is ” is 12 chars, so ‘worth’ starts at 13 and is 5 long. PDFs vary (13,6 still prints ‘worth ’ with a space) — explain the counting in viva.

5C · LPAD / RPAD — pad to a width (Q7–Q8)

Template: LPAD(string, total_length, pad_char). Total includes the original.

SELECT LPAD('Be honest', 13, '#') FROM DUAL;   -- '####Be honest' (9+4=13)
SELECT RPAD('Work Hard', 13, '$') FROM DUAL;   -- 'Work Hard$$$$'

5D · TRIM family (Q9–Q11, Q14)

SELECT LTRIM('money is not everything', 'money ') FROM DUAL;  -- Q9: strips leading set
SELECT RTRIM(LTRIM('money', 'm'), 'y') FROM DUAL;            -- Q10: 'one' (nest them)
SELECT RTRIM('not', 't') FROM DUAL;                            -- Q11: 'no'
SELECT RTRIM('Actions speak louder than words', 's') FROM DUAL; -- Q14: trims trailing s → '…word'
-- standard TRIM you can also quote:
SELECT TRIM(BOTH '#' FROM '##hi##') FROM DUAL;  -- 'hi'

5E · REPLACE (Q12–Q13, Q15)

SELECT REPLACE('Practice makes perfect', 'perfect', 'a man perfect') FROM DUAL;
SELECT REPLACE('When it rains, it pours', 'pours', 'pains') FROM DUAL;
SELECT REPLACE('You cannot have your cake and eat it too', 'not') FROM DUAL; -- 3rd arg omitted = delete 'not' → positive sentence
EXPERIMENT 6 · NUMBERS, DATES, AGGREGATES

ROUND, TRUNC, MOD, MONTHS_BETWEEN, ADD_MONTHS, SUM / AVG / MAX / MIN

6A · ROUND vs TRUNC — the sign of the second argument

Second argMeansExample
0 / omittednearest integerROUND(1233.678,0) = 1234
+nn digits after pointROUND(1233.678,2) = 1233.68
-nn digits before pointROUND(1299.678,-2) = 1300
SELECT ROUND(1233.678, 0) FROM DUAL;   -- 1234 (Q7)
SELECT ROUND(1233.678, 2) FROM DUAL;   -- 1233.68 (Q8)
SELECT ROUND(1299.678, -2) FROM DUAL;  -- 1300 (Q9)
SELECT TRUNC(189.987) FROM DUAL;         -- 189: cuts, never rounds (Q10)
SELECT TRUNC(189.987, 2) FROM DUAL;      -- 189.98 (Q11)
SELECT TRUNC(189.987, -2) FROM DUAL;     -- 100 (Q12)
One-liner for viva: “ROUND looks at the next digit and may go up; TRUNC just chops toward zero.”

6B · MOD — remainder (Q13–Q15)

SELECT MOD(19987, 23) FROM DUAL;        -- integer remainder
SELECT MOD(19987.555, 23) FROM DUAL;    -- works with decimals
SELECT MOD(-19987.555, 23) FROM DUAL;   -- sign follows the dividend (negative)

6C · Dates — experience, gaps, shifts (Q16–Q17, Q22–Q23)

-- Q16 (corrected): experience in years
SELECT ROUND(MONTHS_BETWEEN(SYSDATE, date_of_joining) / 12) AS experience_years FROM employee_book;
-- Q17: months between Jun-2018 and May-2023 ≈ 60
SELECT MONTHS_BETWEEN(TO_DATE('01-06-2023','DD-MM-YYYY'), TO_DATE('01-05-2018','DD-MM-YYYY')) FROM DUAL;
-- Q22/Q23: shift a date by ±6 months
SELECT ADD_MONTHS(TO_DATE('06-05-2023','DD-MM-YYYY'), 6) FROM DUAL;   -- +6 → Nov 2023
SELECT ADD_MONTHS(TO_DATE('06-05-2023','DD-MM-YYYY'), -6) FROM DUAL;  -- −6 → Nov 2022

6D · Aggregates — one row answers (Q18–Q21 + COUNT)

SELECT SUM(employee_salary) FROM employee_book;   -- total
SELECT AVG(employee_salary) FROM employee_book;   -- average
SELECT MAX(employee_salary) FROM employee_book;   -- highest
SELECT MIN(employee_salary) FROM employee_book;   -- lowest
SELECT COUNT(*) FROM employee_book;              -- how many rows
-- Q19 corrected: average experience
SELECT AVG(ROUND(MONTHS_BETWEEN(SYSDATE, date_of_joining) / 12)) FROM employee_book;
Aggregates ignore NULLs (except COUNT(*)). If asked “per city / per section”, add GROUP BY city.
REVERSE-ENGINEERED · READ THIS NIGHT BEFORE EXAM

Your professor's pattern — and the paper she'll likely set

Decoded from Expt 2–6 PDFs (text-vs-code mismatches, Before/After boxes, “identify difference / check error / write inference / justify”). She is a Template Recycler + Edge-Case Tester + Inference Demander. Values change, concepts don't.

Her 6 fingerprints (with proof)

FingerprintProof from your PDFsWhat it means for you
1. Value-swap — question says X, code says Y“BETWEEN 2000–9000” → code 6000–15000 · “starts with K” → code 'p%' · “below 25” → code age>25Never memorise numbers/letters. Memorise the template.
2. Complementary pairsBETWEEN/NOT BETWEEN · IN/NOT IN · NULL/NOT NULL · AND/OR · ASC/DESC · UNION/UNION ALLIf she asks one, rehearse its opposite too.
3. Parameter sweepsROUND(0/+2/−2) · TRUNC(omit/+2/−2) · MOD(int/decimal/negative) · ADD_MONTHS(+6/−6)She picks one value per sweep. Learn all three.
4. Error + inference demanding“check the error displayed” (2-col UNION 3-col → ORA-01789) · “identify difference, display both” · “write output and inference” · “justify with example”Half marks = output + one-line why. Always speak the inference.
5. Story + proverb literalsSalary hike 10% / retirement 60−age / burden / loss-cut 25% · ‘Nothing is impossible’ · ‘A picture is worth…’ · ‘all is well’ · ‘Be honest’Expect business stories + moral quotes, not ‘abc’.
6. Null/edge + single-commandINSTR ‘z’→0 · SUBSTR 1000→NULL · capital ‘I’ · “in a single command” nested TRIM · REPLACE with omitted arg (delete)Every function has a failing twin. Practise the failing twin.

Predicted system paper in HER voice (Aim → Code → Output → Inference)

How to use: cover the Code, read only the Aim, write it on the system, then uncover. Say the Inference out loud — that's what she grades.
P1 · “Search the name starting with ‘S’ and city of 5 characters. Display NULL-salary rows.” (Expt 2 template)
SELECT * FROM employee WHERE name LIKE 'S%';     -- starts with S
SELECT * FROM employee WHERE address LIKE '_____'; -- exactly 5 = 5 underscores
SELECT * FROM employee WHERE salary IS NULL;  -- never = NULL
Output: S% → Kiran/Sita rows · _____ → 5-letter cities only · IS NULL → rows with blank salary. Before: full table. After: filtered rows.
Inference: %=any length, _=exactly one; NULL needs IS NULL.
P2 · “The company hikes salary 15% — show ‘revised salary’, oldest first. Write as a sentence.” (Expt 3 story)
SELECT emp_name, salary * 1.15 AS "revised salary" FROM employee_details ORDER BY age DESC;
SELECT 'The employee name is ' || emp_name || ' from ' || city FROM employee_details;
SELECT SYSDATE AS "Today's Date" FROM DUAL;
Output: calculated column with space-alias, oldest on top; one sentence per row; one date row.
Inference: alias with space needs "…"; Oracle joins with || (CONCAT takes only 2 args).
P3 · “Display cricket+football with UNION and UNION ALL. Identify difference. Then join 2 cols with 3 cols and check error.” (Expt 4 trap)
SELECT player_name FROM cricket_players UNION SELECT player_name FROM football_players;
SELECT player_name FROM cricket_players UNION ALL SELECT player_name FROM football_players;
-- deliberate error she WILL ask for:
SELECT player_id, player_name FROM cricket_players UNION SELECT * FROM basketball_players;
Output: UNION → 9 distinct rows; UNION ALL → 10 rows with duplicate; error query → ORA-01789: query block has incorrect number of result columns.
Inference: UNION de-duplicates+sorts (slower); UNION ALL keeps all (faster); column counts must match.
P4 · “a) WHERE name='ranga' b) WHERE name='RANGA' — output and inference. Show UPPER/LOWER/INITCAP.” (Expt 4 case)
SELECT * FROM cricket_players WHERE player_name = 'ranga';  -- maybe 0 rows
SELECT * FROM cricket_players WHERE player_name = 'RANGA';  -- maybe 0 rows
SELECT UPPER('all is well'), LOWER('TODay'), INITCAP('every man dies') FROM DUAL;
-- fix she wants to hear:
SELECT * FROM cricket_players WHERE UPPER(player_name) = 'RANGA';
Output: ‘ALL IS WELL’ / ‘today’ / ‘Every Man Dies’; a/b return 0 rows if stored as ‘Ranga’.
Inference: = is case-sensitive; wrap both sides in UPPER() for case-blind search.
P5 · “Find ‘t’ in ‘Nothing is impossible’; ‘b’ from end; ‘z’ (null case); cut ‘worth’; pad ‘Be honest’.” (Expt 5 sweep)
SELECT INSTR('Nothing is impossible','t',1,1) FROM DUAL;   -- 3
SELECT INSTR('Nothing is impossible','b',-1,1) FROM DUAL;  -- from end
SELECT INSTR('Nothing is impossible','z',1,1) FROM DUAL;   -- 0
SELECT SUBSTR('A picture is worth a thousand words',14,5) FROM DUAL; -- worth (PDF prints 13,6 = ' worth' with space)
SELECT LPAD('Be honest',13,'#') FROM DUAL;  -- ####Be honest (9+4)
SELECT RTRIM(LTRIM('money','m'),'y') FROM DUAL;  -- one: single command
SELECT REPLACE('When it rains, it pours','pours','pains') FROM DUAL;
Output: 3 / 19-ish / 0 / ‘worth’ / ‘####Be honest’ / ‘one’ / ‘…pains’.
Inference: INSTR args = (string, char, start, occurrence); −start = backwards; missing = 0 (not NULL); LPAD total includes original.
P6 · “ROUND/TRUNC/MOD trio, experience, ADD_MONTHS ±6, SUM/AVG/MAX/MIN.” (Expt 6 sweep — corrected)
SELECT ROUND(1299.678,-2), TRUNC(189.987,2), MOD(-19987.555,23) FROM DUAL;
-- corrected parens (her sheet misses one):
SELECT ROUND(MONTHS_BETWEEN(SYSDATE, date_of_joining)/12) AS exp_yrs FROM employee_book;
SELECT ADD_MONTHS(TO_DATE('06-05-2023','DD-MM-YYYY'),6) FROM DUAL;
SELECT SUM(employee_salary), AVG(employee_salary), MAX(employee_salary), MIN(employee_salary) FROM employee_book;
Output: 1300 / 189.98 / negative remainder / per-row experience / Nov-2023 / one aggregate row.
Inference: ROUND rounds, TRUNC chops; MOD sign follows dividend; MONTHS_BETWEEN order matters; aggregates collapse to 1 row; DUAL = 1 row/1 col so COUNT(*)=1.

Viva one-liners she listens for

“BETWEEN includes both ends.”
“% is any length, _ is exactly one.”
“= NULL never works — IS NULL only.”
“UNION dedups+sorts; UNION ALL is faster.”
“= is case-sensitive — use UPPER() both sides.”
“INSTR missing = 0; SUBSTR past-end = NULL.”
“LPAD length is total, not pad-count.”
“Oracle CONCAT takes 2 args — use ||.”
“ROUND rounds, TRUNC chops.”
“MOD sign follows dividend; DUAL has 1 row.”
SYSTEM EXAM · REHEARSE THESE

15 likely system tasks — say the query, then the output

Each takes under a minute once practised. Cover one from each experiment and you cover everything.

1 · Create EMPLOYEE and insert 2 rows (Expt 1+2)
CREATE TABLE employee (id NUMBER(10), name VARCHAR2(20), age NUMBER(3), address VARCHAR2(20), salary NUMBER(10,2));
INSERT INTO employee VALUES (1, 'Kiran', 25, 'Kurnool', 8500);
INSERT INTO employee VALUES (2, 'Anu', 22, 'Delhi', NULL);
2 · Salary between / not between, update one salary
SELECT * FROM employee WHERE salary BETWEEN 2000 AND 9000;
UPDATE employee SET salary = 9000 WHERE id = 1;
3 · LIKE trio + NULL + IN
SELECT * FROM employee WHERE name LIKE 'K%';
SELECT * FROM employee WHERE address LIKE '_____';
SELECT * FROM employee WHERE salary IS NULL;
SELECT * FROM employee WHERE age IN (20, 25);
4 · Alias + hike + ORDER BY + concat sentence
SELECT emp_name, salary * 1.1 AS "expected salary" FROM employee_details ORDER BY salary DESC;
SELECT 'The employee name is ' || emp_name FROM employee_details;
5 · UNION vs UNION ALL, INTERSECT, MINUS

Speak: “UNION removes duplicates, UNION ALL keeps them. Column counts must match. INTERSECT keeps common. MINUS keeps first-only.”

6 · Case demo: UPPER / LOWER / INITCAP + case trap
SELECT UPPER('all is well'), LOWER('TODay'), INITCAP('every man dies') FROM DUAL;
7 · INSTR + SUBSTR with positions
SELECT INSTR('Nothing is impossible', 't', 1, 1), SUBSTR('A picture is worth…', 14, 5) FROM DUAL;
8 · LPAD / RPAD / TRIM / REPLACE
SELECT LPAD('Be honest',13,'#'), RPAD('Work Hard',13,'$'), REPLACE('it pours','pours','pains') FROM DUAL;
9 · ROUND / TRUNC / MOD trio
SELECT ROUND(1299.678,-2), TRUNC(189.987,2), MOD(19987,23) FROM DUAL;
10 · Dates: experience + ADD_MONTHS
SELECT ROUND(MONTHS_BETWEEN(SYSDATE, date_of_joining)/12) FROM employee_book;
SELECT ADD_MONTHS(TO_DATE('06-05-2023','DD-MM-YYYY'),6) FROM DUAL;
Revision order (30 min): Expt 5 strings → Expt 6 numbers/dates → Expt 2 LIKE/NULL → Expt 4 sets/case → Expt 3 alias/order → Expt 1 DDL. Then re-run these 10.