Wednesday, January 31, 2018

SQL Introduction

What is data actually?

Data

• It is stored representation of OBJECTS and EVENTS that have meaning and importance in user’s environment.
• Data can be structure or unstructured.
o Structured – EmpName,address.
o Unstructured – EmpPhoto,AddrMap

Representation of data

KING        10          5000           15-02-08
     JONES       10          4500           02-03-06
     BLAKE       20          3500           15-06-05
     SCOTT       20          2000           12-05-02
     FORD        30          1100           13-04-00
     MILLER      10          1200           14-07-99


What is Information Actually?

Information

It is data that is processed form, such that it increases the knowledge of the person who uses the data.

Representation of Information

Employees Information

Organization:            Date: 12-sep-2010
           
           Ramu Soft                Place: Hyderabad
           
           Name     Department      Salary      DOJ
           
           KING        10           5000       15-02-08
           JONES       10           4500       02-03-06
           BLAKE       20           3500       15-06-05
           SCOTT       20           2000       12-05-02
           FORD        30           1100       13-04-00
           MILLER      10           1200       14-07-99

What is Metadata Actually

• It is the data which describes the properties or characteristics of end users data and the context of the data
• Metadata properties can include information such as:

Data name
Definitions
Length of size
Values allowed
Source of data
Ownership
• Metadata and data are always separate.
• Metadata enables the database designers and programmers to understand exactly in which form the data should exist within the system.

Metadata for employees Information

Data Item Specification

Field Name     Type              Length     

    Min     Max
    
    Empname        Alpha numeric      20             
    Deptno         Integer            6         10      80
    Empsal         Decimal            8         1500    50000
    Hiredate       Date

What is Database Actually?

Database is a platform where we can place the data from the future references. Database is a collection of interrelated data, i.e. database always stores data along with it’s relationships.

Database Management System

• Database management system is a software that is used to create, maintain and provide controlled access to user database.
• Database management systems should provide systematic method of

o Creating the Database.
o Updating the Database.
o Storing the Database.
o Retrieving of data from Database.

Expected features of DBMS software

• Enable end user and application programmers to share the data.
• Enable data shared among multiple application.
• Should not propagate and store data in new files for every new application.
• Should provide facility for……

o Controlling data access.
o Enforce data integrity.
o Manage concurrency control.
o Restoring the data in system failures.

Database Management system evolution

• First time introduced during 1960’s
• Relational model first defined by E.F codd(IBM) in 1970.

Objectives behind Evolution

• Reduce the maintenance cost of software.
• Manage complex data types.
• Provider easier and faster access to data even for novice user.

Different database Models

• Flat file DBMS
• Hierarchical DBMS
• Network DBMS
• Relational DBMS
• Object-Relational DBMS

Database models and their timelines

• Flat file                1960
• Hierarchical             1970
• Network                  1980
• Relational               1990
• Object-Relational        2000

Database as per oracle

• As per oracle database is a collection of data in one more number of files.
• The database is a collection of logical structures and physical structures which are integrated and configured for the integrity of the system.

Logical structures

• In design state the system is represented in the form of Entity relationship model.
• In the database state it is representation of the actual metadata of the database management system software which will be in the form of tablespaces, data dictionary objects etc.

Physical structures

• In this the system is represented in the form of tables, indexes etc.
• Database should have the ability to provide access to external tables for files outside the database, as if the rows in the files were rows in the table.
• Creating structures (Tables & Indexes)
• With in the oracle database, the basic structure is a table used to store data.

Let us understand the Oracle style for data storage

• At the logical structures in the database must be stored with in the database only.
• Oracle maintains a data dictionary, which records metadata about all the database objects.
• The database objects which need physical storages space on the computer system, are allocated space within a table space.

Table space

• It is logical storage unit within oracle database and is not visible in the file system of the machine on which the database resides.
• The table space builds the bridge between the oracle database and the file system in which the tables or index data is stored.
• A data file can be part of one and only one table space.
• There are three types of table spaces in oracle.

o Permanent table space.
o Undo table spaces.
o Temporary tables spaces.
•Each table or index stored in an oracle database belongs to a table space.
•In 10g a big file table space can be created, which can grow to size of Tera bytes of space on disk.

System and data modeling importance

Data models

• database design for both developers and system designers.

Purpose of data models

• Communicate
• Describe
• Investigate
• Analyze
• Categories

Relation database properties

• Should be accessed and modified by executing Structured Query Languages(SQL) statement only.
• Should use set of operator.
• Need not specify the access route to the tables and data.
• There is no need to identified how the data is arranged physically.

How to communicate with RDBMS

• The Structure Query Language is used to communicate with RDBMS.

Generic features of Structure Query Language

• It allows the user communicate with server.
• It is highly efficient.
• It is easy to learn and use.
• It is similar to English language.
• It is platform independent and architecture independent.

What is Database Management System?

A Database Management System is essentially a collection interrelated data and a set of programs to access this data. This collection of data is called the Database. The primary objective of a DBMS is to provide a convenient environment to retrieve and store database information. Database System support single user and multi-user environment. While on one hand DBMS permits only one person to access the database at a given time, on the other RDBMS allows many user simultaneously access to the database.
A Database System consists of two parts namely, Database Management System and Database Application. Database Management System is the program that organizes and maintains the information whereas the Database Application is the program that lets us view, retrieve and update information stored in the DBMS.

• Database is a collection of data in one or more files for the future reference.
• Database is a collection of interrelated data, i.e. database always stores data along with it’s relationships.

Database Models

The main object of the database is store the interrelated data and maintain the data. The very basic elementary piece of data is called as ‘data item’. We assume that item cannot be subdivided into smaller data types and at the same time retain any meaning to the users of the data. The relationship among the data items, which shows how they are related, is called as Data model.

1. File Management System(FMS)
2. Hierarchical Database System(HDS)
3. Network Database System(NDS)
4. Relational Database Management System(RDBMS).

File Management Systems(FMS)

The File Management System was the first method used to store data in a computerized database. Each data item is stored on disk sequentially in one large file. In order to locate one particular item the search starts at the beginning and each item is checked subsequently till the match is found. A particular relationship cannot be drawn between the items other than the sequence in which it is stored.

Drawbacks

• A particular record cannot be located quickly. If the data has be stored, the whole file has to be read and rewritten in the new order.
• It will not support data types.
• It will not support to store or allocate memory dynamically.
• Data cannot be shared with concurrent users.
• Data duplication.
• Very poor security: Operating system provide only a password mechanism for security. This is not sufficiently flexible to enforce security policies in which different users have permission to access different subsets of the data.
• Retrieving data from a file is not faster: We have to write special programs to answer each question a user may want to ask about the data. These programs are likely to be complex because of the large volume of data to be searched.

Hierarchical Database System(HDS)

Data storage is in form of a parent-child relationship. The origin of a data tree is the root. Data located at different levels along a particular branch from the root is called the node. The last node in the series is called the leaf. This model supports One-to-Many relationship. From the figure 1.0 it can be seen that the nodes in the third level are interrelated. Each child has pointer to numerous and there is just one pointer to the parent thus resulting in a One-to-Many relationship.
Suppose an information is required,it is not necessary for the DBMS to search the entire file to locate the data. Instead, it follows and fetches the data.

Disadvantages

It is not possible to enter a new level into the system. As and when such a need arises the entire structure has to be revamped. Another disadvantage is that this model does not support Many-to-Many relationship. In case this sort of relation is required then multiple copies of the same data have to made which result in redundancy. To overcome this drawback, the Network Database Model was introduced.

Network Database Systems(NDS)

The main idea behind the NDS model is to bring about Many-to-Many relationship. The relationship between the different data items is called as sets. This system also uses a pointer to locate a particular record(i.c called as Physical Links)

Disadvantages

The use of pointers leads to complexity in the structure. As a result of the increased complexity mapping of related data become very difficult.

Relational Model(RDBMS)

• The Model was first outlined by E.F Codd 1970.
• The Components of Relation Model are:
o Collection of objects or relations that stores the data.
o A set of operations that can act on the relations to produce other relations.
• Data integrity for accuracy and consistency.
• It has only logical representations. (i.e in the form of table(rows and columns.)
• Intersection of rows and columns gives single value.
• No data redundancy.
• No physical link relations are maintain logically.
• Supports NULL values, integrity constraints.
• Provides high security.
• Supports unlimited size.
• Supports to store any data types (number, characters, date, images, audio, text, files.)
• Data can be stored among several users at time.
• Data can also be shared across several plot forms.

• Oracle 10g is proven to be fastest database for Transaction processing Datawarehousing, and third party applications on servers of all sizes.
• Use of Flashback Queries
1) It queries the database by TIME or user specified SCN (System Change Number).
2) It uses Oracle’s multi version read-consistency capabilities to restore data by applying UNDO as needed.

ENTITY RELATIONSHIP MODEL

• In an effective system data is divide into discrete categories or entities.
• An ER-Model is an illustration of various entities in a business and the relationships between them.
• It is built during the analysis phase of the System Developing Life Cycle.
• ER-Model separates the information required and the business from the activities performed.

ER-Model Benefits

• It document information for the organization in a clear, precise format.
• Provides a clear picture of the scope of the information requirement.
• Provides an easily understood pictorial map for the database design.
• It offers an effective framework for integrating multiple application.

Thanks for reading. If you like this post please follow us for more updates about technology related updates.

No comments: