From the course: Oracle Database 12c: Advanced SQL

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Creating simple views

Creating simple views - Oracle Database Tutorial

From the course: Oracle Database 12c: Advanced SQL

Start my 1-month free trial

Creating simple views

- A view is essentially a SQL query that is stored as a database object, and can be accessed using, well, other SQL queries. As we'll see in a moment, views act like tables, but they do not, and this is very important, store the result of the query, or physically take space in your database. So, let's create our very first view. To do that, you can type create or replace view, and type the view name. For example, emp_sales. Then we'll type as, and the query we wish to be stored as part of the view. So, for example, select * from employees where job id='SA_MAN'; short for salesman. Let's create this view. Note that typing create or replace with views, similarly to many other Oracle schema objects, such as procedures, synonyms, and so on, will overwrite an existing view if one exists. But a create view, without replace command, is also applicable. However, if the view already exists, we will get an error that the view already exists. Once our view has been created, we can actually query…

Contents