Compare the Difference Between Similar Terms

Difference Between

Home / Technology / IT / Database /Difference Between View and Table

Difference Between View and Table

November 15, 2011Posted byAdmin

View vs Table

Views and tables, both are two database object types. In simple words, Views are stored or named select queries. They can be created as shown below.

Create or replace view view_name

As

Select_statement;

表由列和行组成。列是一组数据,属于同一数据类型。一行是一系列值,可以来自不同的数据类型。列由列名标识,每行均由表主键唯一识别。使用“创建表” DDL查询创建表。

Create table table_name (

Column_name1 datatype (length),

Column_name2 datatype (length)

….

….

….

);

Views

As mentioned before, each view’s body is a SELECT statement. Views are called as “Virtual tables” of the database. Though the views are stored in the database, they are not run until they are called using another SELECT statement. When they are called using SELECT statements, their stored SELECT queries are executed and show the results. Since views have only SELECT queries as their bodies, they do not need a large space. Here, are some benefits of views,

  1. Once the view is created, it can be called again and again using its name, without writing the SELECT query several times.
  2. Since these views are pre-compiled objects, its execution time is lesser than executing its SELECT query (Body of the view) separately.
  3. Views can be used to restrict the table data access. Therefore, they can be played an important role in data security, as well.

Tables

Table is a collection of rows. Rows can have data from different data types. Each row of the table must be identified by using a unique identifier (Primary key). Tables are the places where we store the data. INSERT, UPDATE, and DELETE queries can be used to insert a new row, update an existing row value and delete a row from the table. SELECT queries should be used to retrieve data from tables. Table structure also can be changed (if need) after it is created. ALTER TABLE queries should be used to change the table structure. Tables need more space than views to store its data content. There are several types of tables in databases.

  1. Internal tables
  2. External tables
  3. Temporary tables

What is the difference betweenViews and Tables?

Views arevirtual tables,which refer to SELECT queries, but tables are actually available in the database.

Views do not need a large space to store its content, but tables need a large space than views to store its content.

Views can be created using “create or replace” syntax. But tables cannot be created using “create or replace”, it must be “create table” syntax. Because table creation DDL does not allow replace.

Table columns can be indexed. But view columns can’t be indexed. Because views are virtual tables.

通过改变sta表结构可以修改tements, but the structure of a view cannot be modified by using ALTER statements. (Views must be recreated to modify its structure)

DML commands can be used to INSERT, UPDATE and DELETE records of tables, but DMLs are only allowed to updatable views, which do not have following in the view SELECT statement.

Set Operators (INTERSECT, MINUS, UNION, UNION ALL)

DISTINCT

Group Aggregate Functions (AVG, COUNT, MAX, MIN, SUM, etc.)

GROUP BY Clause

ORDER BY Clause

CONNECT BY Clause

START WITH Clause

Collection Expression in a Select List

Sub query in A Select List

Join Query

Related posts:

Difference Between View and Stored Procedure Difference Between Primary key and Unique key Difference Between Foreign key and Primary keyDifference Between Foreign key and Primary key Difference Between Schema and Table Difference Between View and Materialized View

Filed Under:DatabaseTagged With:column,database object types,primary key,row,SELECT query,SELECT statement,table,tables,View,view s and tables,views,virtual tables

About the Author:Admin

Coming from Engineering cum Human Resource Development background, has over 10 years experience in content developmet and management.

Leave a ReplyCancel reply

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

Request Article

Featured Posts

Difference Between Coronavirus and Cold Symptoms

Difference Between Coronavirus and Cold Symptoms

Difference Between Coronavirus and SARS

Difference Between Coronavirus and SARS

Difference Between Coronavirus and Influenza

Difference Between Coronavirus and Influenza

Difference Between Coronavirus and Covid 19

Difference Between Coronavirus and Covid 19

You May Like

Difference Between Hypothermia and Hyperthermia

Difference Between Fox and Wolf

Difference Between Rolled Oats and Instant Oats

Difference Between Rolled Oats and Instant Oats

Difference Between Legislation and Regulation

Difference Between Secretion and Excretion

Latest Posts

  • 流产和死产有什么区别
  • What is the Difference Between Manganese Oxide and Manganese Dioxide
  • What is the Difference Between Wheat Barley and Oats
  • What is the Difference Between Steroidal and Nonsteroidal Anti inflammatory Drugs
  • What is the Difference Between Potash and Phosphate
  • What is the Difference Between Magnesium and Magnesium Glycinate
  • Home
  • Vacancies
  • About
  • Request Article
  • 联系我们

Copyright © 2010-2018Difference Between. All rights reserved.Terms of Useand Privacy Policy:Legal.