Views in SQL | Simple View and Complex View Difference

  • Views in SQL:

Views in SQL is nothing but the logical table created from one or more tables.We can use the views to fetch the columns from one or more different tables at a time.In real life specifically views are used in Reporting purpose.To create a report we need data from different tables and need to show it on a single dashboard so we are using the views to fetch the data from different tables.View can contain all rows from the table or selected rows from the table.


View is nothing but virtual table in sql which will fetch data from one or more physical tables

There are 2 types of views in SQL:

1.Simple View-Simple view is view created on single table

2.Complex View-Complex view is view created on more than 1 tables

  • Simple View:

When user wants data or some columns from same table then simple view is used.For an example if there is employee table which has Employee_num,Employee_name,salary columnns and we just need to see Employee_num,Employee_name then user can create a simple view.

Employee_num Employee_name Department Salary
1 Amit OBIEE 680000
2 Rohan OBIEE 550000
3 Rohit OBIEE 430000

Views in SQL

We want to restrict data from the above table and show only Employee_Num and Employee_name then we will use the view.


Create view Viewname

as Select column_name1,Coumn_name2 from tablename.


Create view V_Employee

as Select Employee_num,Employee_name from Employee;

You can access the view using Select statement of SQL:

select * from V_Employee;


Employee_num Employee_name
1 Amit
2 Rohan
3 Rohit
  • Complex View:

Complex view is created on using more than one tables.When user wants to retrieve data from more than 1 table then we have to use complex views.To create complex view there should be relation between 2 tables else cartesian product will come by joining 2 tables.There should be some joining conditions,some filters needs to be considered while creating complex views.

Suppose there are 2 tables:

1.Employee tables:-Employee_name,Employee_num,Department_code columns

2.Department:-Department_code,Deptartment_name columns

We need to create view where we want to show the associated department to employee.Here We need to use complex join.

Create view V_EMP_DEPT

as Select e.Employee_name,d.Department_name

from Employee e,Department d

where e.Department_code=d.Department_code;

If you have any issues regarding SQL Views or If you want notes in PDF format comment below section.


28 Replies to “Views in SQL | Simple View and Complex View Difference”

  1. hi Amit,

    can u please share me the complete oracle notes with simple understanding and example, not as complex as other tutorials

  2. can u please share me the complete SQL,Unix notes with simple understanding and example, not as complex as other tutorials

  3. Hi Amit,

    Thanks! It is easy to understand.
    Please share sql documents and interview questions for experienced professional.


  4. Department code is the common column in both the tabels.
    Then how can you write
    e.department_no =d.department_no
    As department_no is not a column in any of the tables. I

Leave a Reply

Your email address will not be published. Required fields are marked *