Skip to main content

Command Palette

Search for a command to run...

๐Ÿš€ Creating and Using Views in Oracle SQL

Updated
โ€ข2 min read
๐Ÿš€ Creating and Using Views in Oracle SQL

As part of my continued hands-on learning with Oracle Autonomous Database, I explored how to create and use views in SQL. Views are virtual tables that help simplify complex queries and improve data management.

๐ŸŽฏ Objective

The goal of this activity was to:

Understand what a view is Learn how to create a view Use views to simplify data access

๐Ÿ’ป Step 1: Creating the Table

CREATE TABLE employees (

emp_id NUMBER,

emp_name VARCHAR2(50),

department VARCHAR2(50),

salary NUMBER );

๐Ÿงช Step 2: Inserting Data

INSERT INTO employees

VALUES (1, 'Ali', 'IT', 50000); INSERT INTO employees

VALUES (2, 'Ahmed', 'HR', 70000);

INSERT INTO employees VALUES (3, 'Sara', 'IT', 60000);

INSERT INTO employees VALUES (4, 'Zara', 'HR', 65000);

๐Ÿ‘๏ธ Step 3: Creating a View

CREATE VIEW high_salary_employees

AS SELECT emp_name, salary FROM employees WHERE salary > 60000;

๐Ÿ“Š Step 4: Using the View

SELECT * FROM high_salary_employees;

This query retrieves employees with high salaries using the created view.

๐Ÿ’ก What I Learned

What views are in Oracle SQL How to create and use views Simplifying queries using virtual tables

๐Ÿš€ Conclusion

This activity helped me understand how views can simplify data retrieval and improve query readability. Views are widely used in real-world database systems for better data abstraction.

3 views

More from this blog

๏ฟฝ

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

15 posts