Notes of Database Management, DBMS PPT - Study Material
Page 2 :
View, ● It is database object that allows us to create a virtual table in the, database whose contents are defined by query or taken from one or, more tables., ● Types of view:, 1. Read only view, 2. Updatable view, 3. Materialized view
Page 3 :
Advantages of View:, ●, ●, ●, ●, , To restrict data accesses, To make complex query easy, To provide data independence, To prevent different views of same data
Page 4 :
Sequence, ● It is database object that generates unique numbers in sequential order, .It can automatically generate primary key., ● It is either in ascending order or descending order.
Page 5 :
Keywords used in sequence, 1., 2., , 3., 4., 5., 6., 7., , CREATE SEQUENCE:Specify the name of the sequence after the CREATE SEQUENCE, keywords., INCREMENT BY:Specify the interval between sequence numbers after the INCREMENT BY, keyword., START WITH:Specify the first number in the sequence., MAXVALUE:Specify the maximum value of the sequence.(nomaxvalue), MINVALUE:Specify the minimum value of the sequence.(nominvalue), CYCLE:Use CYCLE to allow the sequence to generate value after it reaches the limit, min value, for a descending sequence and max value for an ascending sequence.(nocycle), CACHE:Specify the number of sequence values that Oracle will preallocate and keep in the, memory for faster access.
Page 6 :
Indexes, An index is a schema object. It is used by the server to provide quick access to rows in the table.Indexes provide faster, access to data for operations that return a small portion of the table rows., , For example, if you want to reference all pages in a book that discusses a certain topic, you first refer to the index, which, lists all the topics alphabetically and is then referred to one or more specific page numbers.
Page 7 :
Types of indexes:, , 1., 2., 3., , Unique and nonunique index:A unique index ensures that no two rows of a table have duplicate values in the indexed, column (or columns). A non-unique index does not impose this restriction on the indexed column’s values., Primary/secondary index:Primary indexes are unique indexes that are always have and they can not be null.Secondary, indexes are not unique indexes., Composite index:Indexes that contain two or more columns from the same table they are useful for enforcing uniqueness in, the tables column where no singles column that can uniquely identify a row.
Page 8 :
When should indexes be created:, , 1. A column contains a wide range of values., 2. A column does not contain a large number of null values., 3. One or more columns are frequently used together in a where clause or a, join condition.
Page 9 :
When should indexes be avoided:, ● The table is small, ● The columns are not often used as a condition in the query, ● The column is updated frequently
Page 10 :
Subqueries, A subquery is a query that appears inside another query statement and embedded within the WHERE, clause., ●, ●, ●, ●, ●, ●, , You can place the Subquery in a number of SQL clauses: WHERE clause, HAVING clause, FROM clause., Subqueries can be used with SELECT, UPDATE, INSERT, DELETE statements along with expression operator., It could be equality operator or comparison operator such as =, >, =, <= and Like operator., Subquery must be enclosed in parentheses., Subqueries are on the right side of the comparison operator., ORDER BY command cannot be used in a Subquery. GROUPBY command can be used to perform same, function as ORDER BY command., Use single-row operators with single row Subqueries. Use multiple-row operators with multiple-row Subqueries.