Quantcast
Channel: Answers for "Differences among Synonym, Alias and View of a database table ?"
Viewing all articles
Browse latest Browse all 4

Answer by Leigh Riffel

$
0
0

A synonym of a table is another name that can be used to reference the table.

CREATE OR REPLACE SYNONYM BOB FOR MySchema.MyTable;

This synonym could then be used as follows:

SELECT * FROM BOB;

A view of a table is a stored query that can itself be used as though it were a table.

CREATE OR REPLACE VIEW MySchema.MyView AS
   SELECT Column1 FROM Schema1.Table1;

This view could then be used follows:

SELECT * FROM MySchema.MyView;

An alias of a table is a way to give the table a name to more easily reference the table. In the following example a is an alias for Schema1.Table1:

SELECT a.Column1 FROM Schema1.Table1 a WHERE a.Column2=vMyValue;

Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles





Latest Images