Oracle SELECT Statement πΒΆ
Prerequisites: None
Mentor's Note: In Oracle,
SELECTis your way of asking the database for information. Every data-driven application in the world starts with a SELECT query. π‘
π The Scenario: The Digital HR Office πΒΆ
Imagine you are the HR manager at a tech company. You have a massive filing cabinet (The EMPLOYEES table).
- Goal: You need to pull out a list of all names and their current salaries.
- Action: You "Select" only those two columns and ignore the rest.
π» 1. The Basic SyntaxΒΆ
Example: Fetching Employee NamesΒΆ
ποΈ Architect's Note: Performance & Dual π‘οΈΒΆ
- Avoid
SELECT *: In high-demand Oracle systems, selecting all columns causes unnecessary "Logical Reads" and increases network traffic. Always name your columns! - The
DUALTable: Oracle has a special one-row table calledDUAL. Use it for testing expressions or system functions.
π¨ Visual Logic: The FilterΒΆ
graph LR
A[(Physical Table)] -- "SELECT Filter" --> B[Result Set]
subgraph "Rows & Columns"
B
end