Can SELECT Statements Be Used on Views in Oracle?
Submitted by: AdministratorSelect (query) statements can used on views in the same way as tables. The following tutorial exercise helps you creating a view and running a query statement on the view:
SQL> CREATE VIEW managed_dept AS
SELECT * FROM departments WHERE manager_id IS NOT NULL;
View created.
SQL> SELECT * FROM managed_dept WHERE location_id = 1700;
<pre>DEPARTMENT_ID DEPARTMENT_NAME MANAGER_ID LOCATION_ID
------------- -------------------- ---------- -----------
10 Administration 200 1700
30 Purchasing 114 1700
90 Executive 100 1700
100 Finance 108 1700
110 Accounting 205 1700</pre>
Submitted by: Administrator
SQL> CREATE VIEW managed_dept AS
SELECT * FROM departments WHERE manager_id IS NOT NULL;
View created.
SQL> SELECT * FROM managed_dept WHERE location_id = 1700;
<pre>DEPARTMENT_ID DEPARTMENT_NAME MANAGER_ID LOCATION_ID
------------- -------------------- ---------- -----------
10 Administration 200 1700
30 Purchasing 114 1700
90 Executive 100 1700
100 Finance 108 1700
110 Accounting 205 1700</pre>
Submitted by: Administrator
Read Online Oracle Database Job Interview Questions And Answers
Top Oracle Database Questions
☺ | How To Shutdown Your 10g XE Server? |
☺ | How To Use Values from Other Tables in UPDATE Statements using Oracle? |
☺ | What Is Input Buffer in SQL*Plus? |
☺ | How Much Memory Your 10g XE Server Is Using? |
☺ | What Is the Relation of a User Account and a Schema? |
Top DB Oracle Categories
☺ | Oracle PL-SQL Interview Questions. |
☺ | Oracle DBA Interview Questions. |
☺ | Oracle D2K Interview Questions. |
☺ | OCI Interview Questions. |
☺ | Oracle RMAN Interview Questions. |