Skip to main content

Command Palette

Search for a command to run...

๐Ÿš€ Filtering and Sorting Data in Oracle SQL (Hands-on with Oracle Autonomous Database)

Updated
โ€ข2 min read
๐Ÿš€ Filtering and Sorting Data in Oracle SQL (Hands-on with Oracle Autonomous Database)

As part of my continued journey with Oracle Cloud, I explored how to filter and sort data using SQL queries in Oracle Autonomous Database. These operations are essential for retrieving meaningful information from large datasets.

๐ŸŽฏ Objective

The goal of this task was to:

  • Understand how to filter records using WHERE

  • Sort data using ORDER BY

  • Practice real-world SQL querying techniques

๐Ÿ’ป Step 1: Creating the Table

I created a table named employees:

CREATE TABLE employees (
  emp_id NUMBER,
  emp_name VARCHAR2(50),
  salary NUMBER
);

๐Ÿงช Step 2: Inserting Sample Data

INSERT INTO employees VALUES (1, 'Ali', 50000);
INSERT INTO employees VALUES (2, 'Ahmed', 70000);
INSERT INTO employees VALUES (3, 'Sara', 60000);

๐Ÿ“Š Step 3: Viewing All Records

SELECT * FROM employees;

๐Ÿ” Step 4: Filtering Data using WHERE

SELECT * FROM employees WHERE salary > 55000;

This query filters employees with salaries greater than 55,000.

๐Ÿ”ฝ Step 5: Sorting Data using ORDER BY

SELECT * FROM employees ORDER BY salary DESC;

This sorts employees based on salary in descending order.

๐Ÿ’ก What I Learned

  • How to filter data using WHERE clause

  • How to sort data using ORDER BY

  • Writing efficient SQL queries in Oracle

๐Ÿš€ Conclusion

This hands-on activity helped me understand how to retrieve and organize data effectively using Oracle SQL. These operations are fundamental for real-world database applications.

1 views

More from this blog

๏ฟฝ

๐Ÿš€ Getting Started with Oracle Autonomous Database (Free Tier) โ€“ My First Hands-on Experience

15 posts