General Note: Here we have pulled in the data from a sample database. You can download it from the following link and use it for practicing Click Here For Sample Database

In this tutorial, you will learn how to create view in SQLite.Logically hiding the source table  is called as View. For exmple take an customer table in bank industry. The customer table contains following columns

1.customer_id

2.name

3.age

4.sex

5.mobile

6.address

7.balance etc.

If the bank employee processing the customer data,there is no need to view his personal info like mobile no and address etc. If the employee able to access customer table, they can see all private info of an customer. To avoid this problem view is created.  

Syntax:

create [temp | temporary ]view view_name as select....  

Example


 create view customer_view as select customer_id,name,balance from customer

The customer view contains only customer id , name and balance .So the bank employee only process the bank related data only, they can't see the customer's personnal information.

If the "TEMP" or "TEMPORARY" keyword occurs in between "CREATE" and "VIEW" then the view that is created is only visible to the process that opened the database and is automatically deleted when the database is closed.

You cannot DELETE, INSERT, or UPDATE a view. Views are read-only in SQLite.