Monday, April 21, 2014

Back to basics Part-3


Welcome to part-3 of "Back to Basics" series.



After study of Part-1 and Part-2 ,We have platform ready (Means availability of Database, User, tablespace etc..) using which we can build our database building.



Here is list of database objects:

Table,

View,

Index,

Sequence,

Trigger,

Procedure,

Function,

Package.



You can use any of object from this list as per your requirement.

Let me give short explanation of each of these object.



Table are used for storing(organizing) data into it. Wheneve you want to keep data for your use you have to create table for that and need to insert your data into the table.



Views are define by select sql statement on table. Normally(I repeat Normally !) views does not contain any data, Actual data are stored in Table. When you execute select sql statement it returns data from the table. If you need same select sql statement often and it is much complex to write everytime then you can think to create view for that sql statement. Database keep mapping of view name and sql statement for which view is created.



Index are created on table to retrieve desire row of table more efficiently. How? this is out of context of this series.... Sorry! But will cover that as well in the future.



Remember that Table and Indexes are logical object. Means actual data are stored in data files. But as a user of DBMS it is not require to think that much in the depth. Just remember that data are stored, organize in Tables.



Sequence are independent object which is used to generate sequence of number, Mainly used in auto generation of Primary Key.



Trigger, Procedure, Function and Package are pl/sql block. Now, question is what is Pl/sql?

Pl/sql is database programming language for Oracle. For sql server T-sql is used for Database programming. Using pl/sql (or T-sql for sql server) you can write programming logic and sql statement which is gets executes in DBMS when you call it.









No comments: