Deploying the best E-Resources for Software Engineering Students

We at IT Engg Portal, provide all the Computer and IT Engineering students of Pune University with well compiled, easy to learn notes and other E-resources based on the curriculum

Power Point Presentations and Video Lectures for Download

We provide the most recommended power point presentations and Video Lectures from the most prominent Universities for most of the difficult subjects to ease your learning process

Bundling Codes for your Lab Practicals

Deploying the best of available E-Resources for Tech Preparation (Campus Placements)

The Complete Placement Guide

Our Team has worked hard to compile this E-Book for all students heading for Campus Placements. The book is a complete solution for Technical Preparation for Campus Placements.

Pune University's most viewed website for Computer and IT Engineering

With more than 4,00,0000 pageviews from 114 countries over the globe, we are now the most viewed website for Ebooks and other E- Resources in Computer and IT Engineering

Showing posts with label RDBMS. Show all posts
Showing posts with label RDBMS. Show all posts

Thursday, October 4, 2012

Learn Normalization - 1NF, 2NF & 3NF : DBMS

Article Contributed by


People who have started learning about databases must have frequently come up with the word “Normalization” in quite early stages. The name suggests that it is just about normalizing stuff. But, the story is not that simple. You need to know much about normalization in order to handle databases. It is one of the most important things to learn in database management. (It is assumed that you have the basic knowledge about databases and know how to manage tables). So, let’s straight away start discussing about Normalization in thorough depth.

So what is Normalization?

Normalization is a process of reducing redundancies of data in a database. Quite often we come across tables having a lot of bulk data with many columns. All these data might not be necessary all the time whenever we use those tables. So, a better option is to split up the bulk table into small parts and use only those tables which suit the actual purpose at a given instance of time. In this way, redundancy is reduced. To make the long story short, we can simply say that normalization is a process of dividing a big table into smaller ones in order to reduce redundancy.

To understand the concept in deep, let us take up a simple example.

Suppose we are to manage all the databases of a company (say, My Company). The company must keep track of all the employees, customers, product details and the salary details of all the employees. A simple and straight forward way to do this is to put all this information into a single table and manage all those simultaneously. 

See below.


Looking at the above table, you may feel that it is perfectly fine. After all, what is the problem with it? We have a big table; we have all the information required by the company together in a single space, thus saving a lot of memory. Well and good!

But, now think! If suppose, we need to frequently retrieve/update data about just the employees. Here, does the customer’s information or the product details really matter. Definitely no. So, why use the entire table for using just a part of it? We need a solution to this. And the solution is normalization. What we create using normalization is often called as normal forms. Let study about the popular and most widely used normal forms.

The First Normal Form

To solve the above problem, the first and foremost thing to be done is to divide the entire raw database into smaller tables based on the actual groupings. When each table has been designed, a primary key is assigned to most or all tables. Note that the primary key must be a unique value, so try to select a data element for the primary key that naturally uniquely identifies a specific piece of data.
So, let us take up the same previous example and prepare our First normal form. See the figure below:


As we can see, the big raw database is divided into three smaller tables- one for employee, customers and products details, each.
Thus, to access any one of these tables, we need not handle the other two tables.

The Second Normal Form

The objectives of the second normal form is to take data that is only partly dependent on the primary key and enter that data into another table. Let us take up the same example of Fig 1-2. Consider the table- Employee.

Here, the entire table has information about the personal details as well as the salary information. But, it is well understood that, to pay salary to an employee, the company does not actually need the employee’s personal details. Just his emp_id is sufficient. So, why not use just that? This is the second normal form. Same goes with Customers table. We can separate customer’s information from the order details. 

See the figure below:



The Third Normal Form

The third normal form’s objective is to remove data in a table that is not dependent on the primary key. See the same example of Fig 1-3. For the table named Emp_Pay, the position and position_desc fields are not dependent on primary key (emp_id). So, the better option is to move both these fields to another table. 

See below:





Advantages

As we have already seen in the sections before, normalization has many advantages. Let us list out a few ones:

 Ã˜  Greater overall database organization
    Ø  Reduction of redundant data
    Ã˜  Data consistency within the database
    Ø  A much more flexible database design
 Ã˜  A better handle on database security
    Ã˜  Enforces concept of referential integrity


Disadvantages

Although there are many advantages of normalization, there are some disadvantages too. After all, the popular saying “All the coins have two sides” still holds true. So, let’s go through the disadvantages too.

There is one substantial drawback of a normalized database: reduced database performance.
The factors compromised include CPU usage, memory usage, and input/output (I/O). To In other words, a normalized database requires much more CPU, memory, and I/O to process transactions and database queries than does a denormalized database.


Denormalizing a Database

Denormalization is the process of taking a normalized database and modifying table structures to allow controlled redundancy for increased database performance. A denormalized database is not the same as a database that has not been normalized. The purpose of denormalization is to get rid of the problems discussed in the previous sections.  Denormalization might involve recombining separate tables or creating duplicate data within tables to reduce the number of tables that need to be joined to retrieve the requested data, which results in less I/O and CPU time. 

This is normally advantageous in larger data warehousing applications in which aggregate calculations are being made across millions of rows of data within tables. There are costs to denormalization, however. Data redundancy is increased in a denormalized database, which can improve performance but requires more extraneous efforts to keep track of related data.


So, now you might be confused whether to normalize your database or not. The solution is to normalize the database upto a certain extent. So that, redundancy is controlled to a great extent, without compromising on other factors like CPU usage, memory usage, and input/output (I/O).


                                Download this Article as PDF

Manoj Pisharody (BE-IT)
 manoj@itportal.in
  

-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-


Thursday, August 9, 2012

A few Important Operator and Functions in SQL




      There are many Operators and Functions available in SQL which can be used to make our programming task more easier and conventional. Let us explore a few important functions and operators which can be used for most common cases.

So,
What is an Operator?
=> An operator is a symbol or keyword indicating an operation that acts on one or more elements.

What is a Function?
=> A function is a built-in, named routine that performs a specialized task. Most functions take parenthesized arguments, which are values you pass to the function that the function then uses to perform its task. Arguments can be column names, literals, nested functions, or more-complex expressions.

Let us now have a glance on the most commonly used Operators and Functions. 
(The most traditional operators like +,-,*,/ are ignored here)
  • Creating Derived Columns
You can use operators and functions to create derived columns. A derived column  is the result of a calculation and is created with a SELECT-clause expression that is something other than a simple reference to a column. Derived columns don’t become permanent columns in a table; they’re for display and reporting purposes.


The values in a derived column often are computed from values in existing columns, but you also can create a derived column by using a constant expression (such as a string, number, or date) or system value (such as
the system time).

Consider the following 3 examples for better understanding.

Query : A constant expression in a SELECT clause. No FROM clause is needed, because I’m not retrieving data from a table. 
See the below figure for the result.


Your DBMS will assign the derived column a default name, typically the expression itself as a quoted identifier. You should name derived columns explicitly with an AS clause because  system-assigned names can be long, unwieldy, and inconvenient for database applications to refer.


Now, have a look a better example , Here, I’ve retrieved a column and a constant expression. See the below fig for the result



Finally, have a look at this example for getting a clear picture about derived columns

Query : List the book prices discounted by 10 percent. The derived columns would have DBMS specific default names if the AS clauses were removed. See the below fig for the result. 



  • Concatenating Strings with || Operator
Use the operator || to combine, or concatenate, strings. 

The operator’s important characteristics are:
◆ The operator || is two consecutive vertical-bar, or pipe, characters.
◆ Concatenation doesn’t add a space between strings.
◆ ||, a dyadic operator, combines two strings into a single string: ‘formal’ || ‘dehyde’ is 
     ‘formaldehyde’.
◆ You can chain concatenations to combine multiple strings into a single string: ‘a’ || ‘b’ || ‘c’ 
     || ‘d’ is ‘abcd’.
◆ Concatenation with an empty string (‘’) leaves a string unchanged: ‘a’ || ‘’ || ‘b’ is ‘ab’.
◆ The result of any concatenation operation that involves a null is null: ‘a’ || NULL || ‘b’ is 
     NULL. 

How do we use it?

To concatenate strings:

◆ Type:  string1 || string2

Explanation : 
String1 and string2 are the strings to be combined. Each operand is a string expression such as a column that contains character strings, a string literal, or the result of an operation or function that returns a string


Let's have a look at a few example for better understanding

Query : List the authors’ first and last names, concatenated into a single column and sorted by last name/ first name.


Example 2 : 
 List biography sales by descending sales order. Here, I need to convert sales from an integer to
a string.


Example  3 :
 List biographies by descending publication date. Here, I need to convert pubdate from a datetime to a string.





  • Extracting a Substring with SUBSTRING()
Use the function SUBSTRING() to extract part of a string. The function’s important characteristics are:

◆ A substring is any sequence of contiguous characters from the source string, including an empty string or the entire source string itself.
◆ SUBSTRING() extracts part of a string starting at a specified position and continuing for a specified number of characters.
◆ A substring of an empty string is an empty string.
◆ If any argument is null, SUBSTRING() returns null. (But see the Oracle exception in the DBMS Tip in this section.)

How do we use SUBSTRING() function

◆ Type:
SUBSTRING(string FROM start [FOR length])
Explanation : string is the source string from which to extract the substring. string is a string  expression such as a column that contains character strings, a string literal, or the result of an operation or function that
returns a string. start is an integer that specifies where the substring begins, and length is an integer that specifies the length of the substring (the number of characters to return). start starts counting at 1. If FOR length is omitted, SUBSTRING() returns all the characters from start to the end of string

Example : List the first initial and last name of the authors from New York State and Colorado.



  • Changing String Case with UPPER() and LOWER()
Use the function UPPER() to return a string with lowercase letters converted to uppercase, and use the function LOWER() to return  a string with uppercase letters converted to lowercase. The functions’ important characteristics are:
◆ A cased character is a letter that can be lowercase (a) or uppercase (A).
◆ Case changes affect only letters. Digits, punctuation, and whitespace are left unchanged.
◆ Case changes have no effect on empty strings (‘’).
◆ If its argument is null, UPPER() and LOWER() return null. 

How do we use it?
To convert a string to uppercase or lowercase:

◆ To convert a string to uppercase, type: UPPER(string) 
     or
◆To convert a string to lowercase, type: LOWER(string)

Explanation : 
String is a string expression such as a column that contains character strings, a string literal, or the result of an operation or function that returns a string

Example : List the authors’ first names in lowercase and last names in uppercase







  • Trimming Characters with TRIM()
Use the function TRIM() to remove unwanted characters from the ends of a string. The function’s important characteristics are: 

◆ You can trim leading characters, trailing characters, or both. 
     (You can’t use TRIM() to remove characters from within a string.)
◆ By default, TRIM() trims spaces, but you can strip off any unwanted characters, such as leading and    
     trailing zeros or asterisks.
◆ TRIM() typically is used to format results and make comparisons in a WHERE clause.
◆ TRIM() is useful for trimming trailing spaces from CHAR values.
◆ Trimming has no effect on empty strings (‘’).
◆ If any argument is null, TRIM() returns null.

How do we use it?

To trim spaces from a string:

◆ Type:
TRIM([[LEADING | TRAILING | BOTH] FROM] string)

Explanation :
String is a string expression such as a column that contains character strings, a string literal, or the result of an operation or function that returns a string. Specify LEADING to remove leading spaces, TRAILING to remove trailing spaces, or BOTH to remove leading and trailing spaces. If this specifier is omitted, BOTH is assumed.

Example : Strip the leading H from the authors’ last names that begin with H.


  • Finding the Length of a String with CHARACTER_LENGTH()
Use the function CHARACTER_LENGTH() to return the number of characters in a string.
The function’s important characteristics are:
◆ CHARACTER_LENGTH() returns an integer greater than or equal to zero.
◆ CHARACTER_LENGTH() counts characters, not bytes
◆ The length of an empty string (‘’) is zero.
◆ If its argument is null, CHARACTER_LENGTH() returns null.

How do we use it?

To find the length of a string:
◆ Type: CHARACTER_LENGTH(string)

Explanation :
String is a string expression such as a column that contains character strings, a string literal, or the result of an operation or function that returns a string.

Example : List the lengths of the authors’ first names. 




-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-







Saturday, November 19, 2011

Advance Database Management : [ BE- IT ] Download


Advance Database Management Syllabus :
 BE- IT 

Unit I Overview
PL/SQL – Introduction to PL/SQL – Declare, begin statements, Variables,  Control Structure, PL/SQL Transactions – Savepoint, Cursor, PL/SQL Database Objects – Procedures, Functions, Packages, Triggers. Programmatic SQL – Embedded SQL, Dynamic SQL, and ODBC Standard.

Unit II Transaction processing and concurrency control
Definition of Transaction and ACID properties. Transaction Processing - Transaction-processing monitors, transactional workflows, main-memory databases, real-time transaction systems, long-duration transactions,
transaction management in multi-databases. Concurrency Control – Locks, Optimistic Concurrency Control (Backward and Forward validations), Timestamping Concurrency Control.

Unit III Object-based databases and xml
Object-based databases – Complex data types, structured types and inheritance in SQL, table inheritance, array and multiset types in SQL, objectidentity and reference types in SQL, implementing O-R features, Persistent programming languages, OO vs OR. XML – Structure of XML, Document Schema, Querying and Transformation, API in XML, XML applications.

Unit IV Data warehousing
Introduction to Data Warehousing – Concepts, Benefits and Problems, DW Architecture – Operational Data, load manager, meta data, DW Data flows – inflow, upflow, meta flow, DW tools and technologies – Extraction, cleansing and transformation tools, DW DBMS, admin and management tools, data marts – reasons and issues, Data Warehousing using Oracle. Data Warehousing Design – Designing, Dimensionality modeling, Design methodology, DW deign using Oracle.

Unit V Olap and data mining
On-line Analytical Processing – OLAP BenchMarks, applications, benefits, tools, categories, extensions to SQL, Data mining – introduction, techniques, predictive modeling, tools. Data mining algorithms – Apriori, Decision tree, k-means, Bayesian classifier.

Unit VI Database security
Security and integrity threats, Defence mechanisms, Statistical database auditing & control. Security issue based on granting/revoking of privileges, Introduction to statistical database security. PL/SQL Security – Locks – Implicit locking, types and levels of locks, explicit locking, Oracles’ named
Exception Handlers.



Unit
Download Link
Unit 1
Unit 2
Unit 3
Unit 4
Unit 5
Unit 6



 Books to Download for ADBMS

Database System Concepts
Korth, Sudarshan,Silberschatz




--------------------------------------------------

Fundamentals of Database Systems
Elmasari , Navathe


---------------------------------------------------
Data Warehousing for dummies



------------------------------------------
Database Management Systems
Raghu Ramkrishnan, Gehrke



---------------------------------------

Database Systems
A Practical Approach to Design, Implementation & Management
Thomas Connolly, Carolyn Begg


--------------------------------
Data Mining : Concepts  Techniques
Han, Kamber, Pei



-----------------------------------

Handbook of Database Security
Applications and Trends
Gertz, Jajodia,



----------------------------------------------
Data Warehousing : OLAP & Data Mining



-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-


====================================
Video Lectures
====================================

Introduction to Database Systems

What is relational Database


Data Warehousing - Basics



Introduction to  Data Warehousing
 & OLAP



Data Warehousing - Definition
What is Data Mining?


Database Security



What is OLAP?





-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-