Categories: SQL Tutorials

Complex View in SQL with Example | Complex View Examples

In my previous article i have given the difference between simple view and complex view in SQL. In this article i would like to throw light on what is mean by complex view in SQL and what are its different examples. If you faced the interviews like SQL interviews you faced this question about what is mean by complex view in SQL.

What will you find in this article?

1.What is mean by view in SQL and its types?

2.What is Complex view in SQL with real example.

What is view in SQL?

The view is nothing but the snapshot of the database. If we want specific data from single table or multiple tables which needs to be used again and again then the views are useful. You can say in simple words view in SQL is nothing but the logical table created from one or more tables. There are multiple usages of views in SQL like reporting purpose or if we want to fetch the logical data from multiple table again and again then we can create the view.

View in SQL

There are two types of views in SQL :

  1. Simple view : When the view is been created on View in SQL
  2. Complex view : When the view is been created on multiple tables then it is called as complex view.
  3. Materialized view : The materialized view is view like a physical table which is used mainly for performance management.

What is Complex view in SQL with real example?

In this section I would like to explain about complex view in SQL with real life example.

  1. Complex view is view which uses multiple data together and create the snapshot of the data.
  2. Relation between table : The relation between multiple table is must to create the complex views.
  3. Complex view is nothing but the view which has been created with multiple joins, group by statements or set operators to fetch the complex data from multiple tables.
  4. The complex views are used to fetch the complex operations to fetch the complex data from multiple table.

Real life example of Complex view in SQL :

If there are two tables Customer table and Items table and I want to prepare the report where Customer bought the items .

1.Customer :-Customer_name, Customer_num, Customer_code columns

2.Item:-Customer_code,Item_code,Item_name,Item_category columns

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

Create view V_Customer

as Select e.Customer_name,d.Item_name

from Customer e,Item d

where e.Customer_code=d.customer_code

Group by item_category;

The above view will give you the details about the Customer_name and associated item with customer group by the item category. So this kind of view is called as complex view.

Amit S

Oracle Consultant with vast experience in Oracle BI and PL/SQL Development. Amiet is the admin head of this website who contributes by preparing tutorials and articles related to database technologies. He is responsible to manage the content and front-end of the website.

Recent Posts

The Essential Guide to Cryptocurrency Exchange Platform Development for Beginners and Beyond

Introduction Cryptocurrencies took the world by storm, setting up a new financial system and breaking…

12 months ago

Top 20 System Administrator Interview Questions and answers

In my previous article I have given Top 20 technical support interview questions with its…

1 year ago

Desktop Support Scenario Based Interview Questions

In my previous articles I have given 15 most asked desktop support interview questions with…

1 year ago

How Do Business Analysts Use SQL for Their Needs?

A business analyst is someone who is versed in processes of data analysis used for…

1 year ago

Top 15 Control-M Interview Questions with Answers

In my previous article I have already given top questions and answers for Desktop support…

1 year ago

Top 20 SQL Interview Questions for Production Support

In my previous article I have given unix production support interview questions and answers. In…

1 year ago