Professional Documents
Culture Documents
JOINS:
When the required data are in more than one tables are joined using
the join function .The joined condition combines a row in one table
in another table based on the same values in the common column
Cartesian product :
TYPES OF JOINS:
(1) UNION
It returns all rows from both queries but duplicated rows are not repeated
It takes the output from the two queries
Combining the both the values
(3) Intersect:
VIEWS:
In SQL, a view is a virtual table based on the result-set of an
SQL statement. A view contains rows and columns, just like a real table. The fields in
a view are fields from one or more real tables in the database. You can add SQL
statements and functions to a view and present the data as if the data were coming
from one single table.
CREATING A VIEW:
Example:
ALTERING A VIEW:
When you alter an underlying table the view becomes invalid. You need to
recompile that view to make it valid again. The Alter view statement is used for the
recompilation of a view.
Syntax
SEQUENCES:
Creating Sequences:
Syntax:
TABLE INDEXES:
The CREATE INDEX statement is used to create indexes in tables. Indexes are used to
retrieve data from the database more quickly than otherwise. The users cannot see the
indexes, they are just used to speed up searches/queries.
Syntax
CREATE INDEX index_name
ON table_name (column1, column2, ...);
EXAMPLE