0

What is the difference between "view" and "synonym" in Oracle?

This is what I think:

  • View can be created using multiple tables. View is logical and does not occupies space.
  • Synonym can be created for single table, view, sequence or index. Synonym is physical and needs space.

Is this correct? If not, then what is it?

Andrew T.
  • 4,701
  • 8
  • 43
  • 62
Snehal
  • 47
  • 1
  • 1
  • 7
  • 2
    That is not how this site works. If you have a specific question, then ask it. – juergen d Jul 28 '14 at 11:06
  • @juergen d - please tell me how to make above question more specific. I am new to this site – Snehal Jul 28 '14 at 11:08
  • @srg20: These are questions where a simple google search would do. If you have a specific program related problem, exception, issues, you may ask here. – ngrashia Jul 28 '14 at 11:14

3 Answers3

5

Table is a basic unit of data storage in an oracle database. It holds all user accessible data.

View is a virtual table

  • It can be created on a table or another view.
  • It is just like a window through which we can access or change base table data.
  • It does not contain data of its own. It always takes data from its base table.
  • It is stored as a query in data dictionary. Whenever you query a view it gets data from its based table using this query.

Main advantage of using views are

  • You can restrict access to predetermined set of rows and columns of a table
  • You can hide complexity of query
  • You can hide complexity of calculation

Synonym is alternate name given to table, view, sequence or program unit.

  • It is used to mask real name and owner of the object.
  • You can provide public access to tables by creating public synonyms.

Reference : here

Other already answered similar questions and references.

Community
  • 1
  • 1
ngrashia
  • 9,869
  • 5
  • 43
  • 58
1

View:

view is a sub set of table. View is created multiple Tables and to Reduced Query complexity. View contain Select statement and using filter Commands.

Syonynm:

Synonym is mirror of table. Synonym created single table and to reduced Table name complexity. Synonym doesn't Contain Select Statement.

Pavankumar
  • 11
  • 1
1

A view is logical table that is based on table or View. We can create a view to reduce complexity of the query. A Synonym is alternative name for database objects Like a Table, View, Sequence. It can be Public and Private.