Top Banner
A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using database management systems, which store database contents, allowing data creation and maintenance, search and other access.
72

A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

Dec 22, 2015

Download

Documents

Naomi Miles
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

A database consists of an organized collection of interrelated data for one or more uses, typically in digital form.

Digital databases are managed using database management systems, which store database contents, allowing data creation and maintenance, search and other access.

Page 2: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

Purpose of Database: =>A database system should be a repository of data needed for an organization’s data processing. =>This data should be accurate ,private and protected from damage. it should be organized so that diverse applications with different data requirements can employ the data.

Page 3: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

Different application programmers and different end users will have different views of the data which must be derived from a common overall data structure .

The ways in which ends users want to utilize existing data will constantly change, and in some cases demands for new uses of the data will arise rapidly and urgently.

The extent to which these demands can be satisfied determines the overall value of the database system.

Page 4: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

DatabaseDatabase conceptconceptDisadvantage:Disadvantage: 1.inconsistency 1.inconsistency

2.unsharable data 2.unsharable data

3.unstandardized data3.unstandardized data

4.unsecure data4.unsecure data

5.incorrect data.5.incorrect data.

Page 5: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

Database management Database management systemsystem It provides a centralized control of the dataIt provides a centralized control of the data

IT is a software that responsible for storing, maintaining and utilizing database. A database along with a DBMS is referred to as a database system.

AdvantagesAdvantages1.Databases reduces the data redundancy to 1.Databases reduces the data redundancy to

a large extent:a large extent:

=>=>Duplication of data is known asDuplication of data is known as Data Data Redundancy.Redundancy.

The database systems do not maintain The database systems do not maintain separate copies of the same data. Rather, separate copies of the same data. Rather, all the data are kept at one place and all the all the data are kept at one place and all the application that required data refer to application that required data refer to centrally maintained database centrally maintained database

Page 6: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

If any change is to be made to data, it will be made at just one place and the same changed information will be available to all the application referring to it.

Thus redundancy gets controlled and so are problems associated with it.

Page 7: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

Database Management SystemDatabase Management System

Database

End User

Application Programs

Centrally Controlled Database System

Page 8: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

2. Databases can control 2. Databases can control data inconsistency to a data inconsistency to a

large extent.large extent. Inconsistent database provide incorrect or Inconsistent database provide incorrect or

conflict information.conflict information. When the redundancy is not controlled, there may be

occasions on which the two entries about the same data do not agree (when one of them stores the updated information and the other does not).

Data base said to be inconsistent. By controlling redundancy, the inconsistency is also

be controlled. Even if there is some redundancy retained in the

database due to some technical reasons, the database management system ensures that any change made to either of the two entries is automatically made to the other . This process is known as propagating up dates

Page 9: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

3.Databases facilitate 3.Databases facilitate sharing of data:sharing of data: Individual Individual pieces of data in database may pieces of data in database may be shared by different users and be shared by different users and users may have access to the users may have access to the same piece of data for different same piece of data for different purposes.purposes.

The database management system makes sure that data not only the existing application can may be satisfied without having to create any new stored files

Page 10: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

4.Databases enforce 4.Databases enforce standardsstandards

The database management system can ensures that all the data (that is stored centrally ) follow the applicable standards . There may be certain standards laid by the company or organization using database.

Standards storing data formats is particularly desirable as an aid to data interchange or migration between system.

Page 11: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

5.Databases can ensure data 5.Databases can ensure data security: security: The information stored inside a database is sometimes of great value to a corporations.

Data Security: Data Security: It refers to protection of data It refers to protection of data against accidental or intentional disclosure to against accidental or intentional disclosure to unauthorized persons, or unauthorized unauthorized persons, or unauthorized modification or destruction.modification or destruction.

Privacy of Data Privacy of Data :refers to the rights of individuals :refers to the rights of individuals and organizations to determine for themselves and organizations to determine for themselves when “how” and to what extent information when “how” and to what extent information about them is to be transmitted to others.about them is to be transmitted to others.

6.Integrity can be maintained through database: By integrated database we mean unification of

several otherwise distinct data files, with any redundancy among those files partially or whole elimiminated.

Page 12: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

1. A collection of interrelated files and a set of programs that allow users to access and modify these files is known as a data management system.2.Database system is to provide the users only that much information that is required by them.3. A database abstraction layer is an application programming interface which unifies the communication between a computer application and databases such as MySQL, PostgreSQL, Oracle or SQL. Traditionally, all database vendors provide their own interface tailored to their products which leaves it to the application programmer to implement code for all database interfaces he would like to support. Database abstraction layers reduce the amount of work by providing a consistent API to the developer and hide the database specifics behind this interface as much as possible. There exist many abstraction layers with different interfaces in numerous programming languages.

Page 13: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

Database management Database management system (DBMS)system (DBMS)

A collection of interrelated files and a set of A collection of interrelated files and a set of programs that allow users to access and modify programs that allow users to access and modify these files is known as a DBMS.these files is known as a DBMS.

End userEnd user is a person who is not a computer- is a person who is not a computer-trained person .trained person .

An application system analystAn application system analyst is the one is the one who is concerned about the all of the database of who is concerned about the all of the database of logical level. what are the relationships between logical level. what are the relationships between the data-entities .the data-entities .

Physical Storage system analystPhysical Storage system analyst is concerned is concerned with the physical implementation details of the with the physical implementation details of the database. i.e. How would the database the stored database. i.e. How would the database the stored on which storage device. what will be the starting on which storage device. what will be the starting address of the database.address of the database.

Page 14: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

=>Physical storage system =>Physical storage system analystanalyst

It concerned with the physical It concerned with the physical implementation details of the implementation details of the database .i.e. how would the database database .i.e. how would the database be stored on which storage device?be stored on which storage device?

Levels of Database ImplementationLevels of Database Implementation INTERNAL LEVEL (Physical Level):INTERNAL LEVEL (Physical Level):

The lowest level of abstraction, the internal level, is the one closest to physical storage. This level is also sometimes termed as physical level.

It describes how the data are stored on It describes how the data are stored on the storage mediumthe storage medium

Page 15: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

CONCEPTUAL LEVEL:CONCEPTUAL LEVEL: This level of describes what data are actually stored in the database. It also describes the relationships exists among data. The level are not concerned with how these logical in terms of simple data structure

EXTERNAL LEVELEXTERNAL LEVEL : : This is the This is the level closest to the users and is level closest to the users and is concerned with the way in which concerned with the way in which the data are viewed by individual the data are viewed by individual useruser

Page 16: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.
Page 17: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

Sales officer Purchase OfficerSales officer Purchase Officer

View 1Item-Name

Price

View 1Item-Name

Price

External Level

Conceptual LevelItem-number Character(6)Item-Name Characer(20)

Application Programs

are used to fetch

the desired

information

Internal LevelStored-Item Length=40Item # Type=Byte(6),offset=0 Index=IxName Type=Byte(20),offset=6

Page 18: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

Data Independence: Data Independence: The ability to modify a The ability to modify a scheme definition in one level without affecting a scheme scheme definition in one level without affecting a scheme in the next higher level is called Data independence. in the next higher level is called Data independence.

There are two Levels of data independence:There are two Levels of data independence:1.Physical Data Independence:1.Physical Data Independence: The ability to change the

physical schema without changing the logical schema is called physical data independence. For example, a change to the internal schema, such as using different file organization or storage structures, storage devices, or indexing strategy, should be possible without having to change the conceptual.

2.LogicalData Independence2.LogicalData Independence: : The ability to change the logical (conceptual) schema without changing the External schema (User View) is called logical data independence. For example, the addition or removal of new entities, attributes, or relationships to the conceptual schema should be possible without having to change existing external schemas.

=>It more difficult to achieve logical data independence =>It more difficult to achieve logical data independence than physical data independence.than physical data independence.

Page 19: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.
Page 20: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

There are several models for databases:• Tabular ("flat file") – data in a single table,eg. spreadsheet• Hierarchical – e.g.. company departments• Relational– Each row is a record (patient, child etc.)– Each column is an attribute (age, sex etc.)

Page 21: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

=>Relational Data Model=>Relational Data ModelA relational database is a set of related

tables, each concerning a specific topic. Its central idea was to describe a database as a collection of predicates over a finite set of predicate variables, describing constraints on the possible values and combinations of values.

The data is organized into tables (i.e. row The data is organized into tables (i.e. row and columns). and columns).

Tables are called Relations. Tables are called Relations. A Row in a table represents a relationship A Row in a table represents a relationship

among a set of values. since a table is a among a set of values. since a table is a collection of such relationshipscollection of such relationships

Page 22: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

For exampleFor example Suppliers (Suppliers (Supp#,Supp#, supp-name, Status, supp-name, Status,

City)City) Underlined fields indicate primary keyUnderlined fields indicate primary keyAdvantages: – Reduction of data redundancy – Eliminates inconsistencies (errors). – High data integrity and quality. – Data can be descriptive. – Allows implementation of security.

Page 23: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.
Page 24: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

Primary-key is the key-field that can Primary-key is the key-field that can uniquely identify a row in a relation.uniquely identify a row in a relation.

SuppliersSuppliers

Supp# Supp-Name Status City

S1 Britannia 10 Delhi

S2 New Bakery 30 Mumbai

S3 Mother Dairy 10 Delhi

S4 Cook 50 Bangalore

S5 Haldiram 40 Jaipur

Page 25: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

Row of relations are known as Row of relations are known as tuplestuples and columns are known as and columns are known as AttributeAttribute

The relational data model is The relational data model is based on a collection of tables based on a collection of tables (relations)(relations)

Page 26: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

Conceptual design

Logical design

Physical design

Page 27: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

Logical Data Model Logical Process Model

TR

Track 01 Country

Database creationCREATE DATABASECREATE TABLELOAD

PhysicalImplementation

Process

Page 28: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

Current systems evaluation

Development of Standards

Technological feasability

Operational feasability

Economical feasability

Page 29: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

Network Data Model: Network Data Model: The network model is a database model conceived as a flexible way of representing objects and their relationships. Its distinguishing feature is that the schema, viewed as a graph in which object types are nodes and relationship types are arcs, is not restricted to being a hierarchy or lattice.

A A record record is a collection of field is a collection of field (attribute), each of which contains only (attribute), each of which contains only one data values.one data values.

Link mean that it is an association Link mean that it is an association between precisely two recordsbetween precisely two records

Page 30: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

S1 Britannia

10

I6 Cream BiscuitI3 BreadI2 Cake

3020

Page 31: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.
Page 32: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

ADVANTAGES:• Network Model is able to model complex relationships

and represents semantics of add/delete on the relationships.

• Can handle most situations for modeling using record types and relationship types.

• Language is navigational; uses constructs like FIND, FIND member, FIND owner, FIND NEXT within set, GET etc. Programmers can do optimal navigation through the database.

DISADVANTAGES:•Navigational and procedural nature of processing•Database contains a complex array of pointers that thread through a set of records.• Little scope for automated "query optimization”

Page 33: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

A hierarchical data model is a data model in which the data is organized into a tree-like structure. The structure allows repeating information using parent/child relationships: each parent can have many children but each child only has one parent. All attributes of a specific record are listed under an entity type.

Example:

EmpNo

First Name

Last Name

Dept. Num

100 Sally Baker 10-L

101 Jack Douglas 10-L

102 Sarah Schultz 20-B

103 DavidDrachmeier

20-B

Serial Num Type User EmpNo

3009734-4 Computer 100

3-23-283742 Monitor 100

2-22-723423 Monitor 100

232342 Printer 100

Page 34: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

Hierarchical Form (Supplier Superior to Hierarchical Form (Supplier Superior to items)items)

S1 Britannia 10 Delhi

I2 Cake 5.00

I6 Cram Biscuit 10.00

10

20

20

I3 Bread 9.00

Page 35: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

ADVANTAGES:• Hierarchical Model is simple to construct and operate on• Corresponds to a number of natural hierarchically

organized domains - e.g., assemblies in manufacturing, personnel organization in companies

• Language is simple; uses constructs like GET, GET UNIQUE, GET NEXT, GET NEXT WITHIN PARENT etc.

DISADVANTAGES:•Navigational and procedural nature of processing•Database is visualized as a linear arrangement of records•Little scope for "query optimization"

Page 36: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

A relational database matches data by using common characteristics found within the data set. The resulting groups of data are organized and are much easier for many people to understand. For example, a data set containing all the real-estate transactions in a town can be grouped by the year the transaction occurred; or it can be grouped by the sale price of the transaction; or it can be grouped by the buyer's last name; and so on.

Page 37: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.
Page 38: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

Relational Model developed by E.F. Codd Relational Model developed by E.F. Codd (IBM)(IBM)

Relation:Relation: A relation is a table i.e. data A relation is a table i.e. data arranged in rows and columns.arranged in rows and columns.

Domain :Domain : A domain is a pool of values A domain is a pool of values from which the actual values appearing from which the actual values appearing in a given column are drawn.in a given column are drawn.

A domain describes the set of possible values for a given attribute, and can be considered a constraint on the value of the attribute.

A domain is said to be if atomic domain A domain is said to be if atomic domain are considered to be indivisible domain.are considered to be indivisible domain.

Page 39: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

Tuple:Tuple: The row of tables (relations). The row of tables (relations). Attributes:Attributes: The columns of tables The columns of tables

(relations).(relations). The number of attributes in a The number of attributes in a

relation is called relation is called DegreeDegree and the and the number of row in a relation is number of row in a relation is known as known as Cardinality.Cardinality.

View: View: A view is a table that does A view is a table that does not really exist in its own right but not really exist in its own right but is instead derived from one or more is instead derived from one or more underlying base table (sunderlying base table (s).).

Page 40: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

The concept of viewsThe concept of views

Create VIEW GoodItems ASCreate VIEW GoodItems AS ‘name of ‘name of viewview

Select * from ItemsSelect * from Items ‘ Name of base ‘ Name of base tabletable

where Price>12where Price>12 ‘ the ‘ the conditioncondition

Page 41: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

=>=>GoodItems (A virtual GoodItems (A virtual table based on Items table)table based on Items table)

Item# Item-Name Price

I1 Milk 15.00

I4 Milk Bread 14.00

I7 Ice Cream 16.00

I9 Namkeen 15.00

Page 42: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

Primary Key: Primary Key: It is a set of one or more It is a set of one or more attributes that can uniquely identify attributes that can uniquely identify tuples within the relation.tuples within the relation.

Supp# is the primary key for suppliers.Supp# is the primary key for suppliers. Primary key consists of more than one Primary key consists of more than one

attribute ,it is called attribute ,it is called composite-primary composite-primary key.key.

Candidate keys: Candidate keys: All attribute All attribute combinations inside a relation that can combinations inside a relation that can serve as primary key are candidate keys serve as primary key are candidate keys as they are candidates for the primary as they are candidates for the primary key position.key position.

For Example:For Example: Supp# and supp-Name are Supp# and supp-Name are two candidate key in the suppliers two candidate key in the suppliers relation. and also Item# and Item-Name relation. and also Item# and Item-Name are candidate key.are candidate key.

Page 43: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

In case of two or more candidate In case of two or more candidate keys, only one of them serves as keys, only one of them serves as the primary key. the rest of them the primary key. the rest of them areare alternates key.alternates key.

Alternate Key:Alternate Key: A candidate key A candidate key that is not the primary key is that is not the primary key is called an alternate key.called an alternate key.

In suppliers table,In suppliers table, supp-name is supp-name is the alternate key and in the alternate key and in Item Item tabletable Item-Name is the alternate Item-Name is the alternate keykey

Key : A non-key attribute, whose Key : A non-key attribute, whose values are derived fromvalues are derived from

Page 44: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

Foreign-key:Foreign-key: A non –key attribute, A non –key attribute, whose values are derived from the whose values are derived from the primary key of some other table, is primary key of some other table, is known as Foreign-key in its current known as Foreign-key in its current table.table.

Primary key of one table is a foreign Primary key of one table is a foreign key of other table.key of other table.

For Example:For Example:

Page 45: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

Sid Sname Email

01 A [email protected]

02 B [email protected]

Sid Total Fee

Fee Paid FeeBal

01 6000 4000 2000

02 6000 2000 4000

Page 46: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

Referential IntegrityReferential Integrity is a system of is a system of rules that a DBMS uses to ensure that rules that a DBMS uses to ensure that relationships between records in related relationships between records in related tables are valid, and that users don’t tables are valid, and that users don’t accidentally delete or change related accidentally delete or change related data.data.

Relational Algebra:Relational Algebra: The relational The relational algebra is a collection of operations on algebra is a collection of operations on relations. Each operation takes one or relations. Each operation takes one or more relations as its operand(s) and more relations as its operand(s) and produces another relation as its result.produces another relation as its result.

Select operation:Select operation: The Select operation The Select operation selects tuples(horizontal subset) from a selects tuples(horizontal subset) from a relation that satisfy a given condition.relation that satisfy a given condition.

Page 47: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

It is denoted by lower letter Greek letter It is denoted by lower letter Greek letter SigmaSigma

( ( σσ ). ).

For Example :To select those tuples from For Example :To select those tuples from Items relation where the price is more Items relation where the price is more than 14.00.than 14.00.

We shall write; We shall write; σσ Price >14.00(Items) Price >14.00(Items) Item# Item-Name Price

I1 Milk 15.00

I7 Ice Cream 16.00

I9 Namkeen 15.00

Page 48: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

Project Operation:Project Operation: The project operation yields a The project operation yields a “vertical” subset of a given relation .“vertical” subset of a given relation .

In Result, Duplicating tuples are automatically removedIn Result, Duplicating tuples are automatically removedi.i. It is denoted by Greek letter Pi(It is denoted by Greek letter Pi(лл) .) .ii.ii. For Example:For Example:iii.iii. лл Supp-Name, city(Suppliers) Supp-Name, city(Suppliers)

Supp-Name

Britannia

New Bakery

Mother Dairy

Cook

Haldiram

City

Delhi

Mumbai

Delhi

Bangalore

Jaipur

Page 49: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

Supp# Supp-Name

Status City

S1 Britannia 10 Delhi

S2 New Bakery

30 Mumbai

S3 Mother Dairy

10 Delhi

S4 Cook 50 Bangalore

S5 Haldiram 40 Jaipur

Page 50: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

Cartesian Product operation:Cartesian Product operation: The The Cartesian product is a binary operation.Cartesian product is a binary operation.

It is denoted by a cross(X).It is denoted by a cross(X). The Cartesian product of two relations A The Cartesian product of two relations A

and B is written as A X B.and B is written as A X B. It produce a new relation which has a It produce a new relation which has a

degree equal to the sum of the degree degree equal to the sum of the degree of the two relations operated upon.of the two relations operated upon.

All tuples of first relation are All tuples of first relation are concatenated with all the tuples of concatenated with all the tuples of second relation to form the tuples of the second relation to form the tuples of the new relation.new relation.

Page 51: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

Stud#Stud# Stud-Stud-NameName

HostelerHosteler

S001S001 SurajSuraj YY

S002S002 PreetiPreeti NN

S003S003 AsraAsra NN

Inst#Inst# Inst-NameInst-Name SubjectSubject

I01I01 KVS, KVS, jabalpurjabalpur

IPIP

I02I02 KVS, KVS, kurnoolkurnool

MathMath

StudentStudent

InstructorInstructor

Page 52: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

Stud#Stud# Stud-Stud-NameName

HosteleHostelerr

Inst#Inst# Inst-Inst-NameName

SubjectSubject

S001S001 SurajSuraj YY I01I01 KVS, KVS, jabalpujabalpurr

IPIP

S001S001 SurajSuraj YY I02I02 KVS KVS kurnoolkurnool

MathMath

S002S002 PreetiPreeti NN I01I01 KVS, KVS, jabalpujabalpurr

IPIP

S002S002 PreetiPreeti NN I02I02 KVS KVS kurnoolkurnool

MathMath

S003S003 AsraAsra NN I01I01 KVS, KVS, jabalpujabalpurr

IPIP

S003S003 AsraAsra NN I02I02 KVS KVS kurnoolkurnool

MathMath

Page 53: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

Union operation:Union operation: The union operation The union operation is a binary operation that requires two is a binary operation that requires two relations as its operands. It produces a relations as its operands. It produces a third relation that contains tuples from third relation that contains tuples from both the operand relationsboth the operand relations

It is denoted by U.It is denoted by U. Union of two relations x and y is x U yUnion of two relations x and y is x U y Condition for union operationCondition for union operation

1.The relations A and B must be of the 1.The relations A and B must be of the same degree. that is, they must have same degree. that is, they must have the same number of attribute.the same number of attribute.

2. The domains of the ith attributes of A 2. The domains of the ith attributes of A and ith attribute of B must be the and ith attribute of B must be the same.same.

Page 54: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

ExamplesExamples

Drama SongDrama Song

Roll Roll NoNo

NamNamee

AgAgee

1313 RushRush 1515

1717 SwatiSwati 1414

Roll NoRoll No NameName AgeAge

22 ManyaManya 1515

1010 RishabRishabhh

1515

1313 RushRush 1313 Result of Drama U Song will Result of Drama U Song will bebe

Roll NoRoll No NameName AgeAge

22 ManyaManya 1515

1010 RishabRishabhh

1515

1313 RushRush 1313

1717 SwatiSwati 1414

A B

Page 55: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

The Set Difference Operation:The Set Difference Operation: The set difference operation The set difference operation

gives tuples that are in one gives tuples that are in one relation but not in anotherrelation but not in another

It is denoted by –(minus).It is denoted by –(minus). The expression A-B results in a The expression A-B results in a

relation containing those tuples relation containing those tuples in A but in B.in A but in B.

Result of Drama – Song will beResult of Drama – Song will be

Roll NoRoll No NameName AgeAge

1717 SwatiSwati 1414 A B

Page 56: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

The set Intersection operationThe set Intersection operation The set intersection operation finds The set intersection operation finds

tuples that are common to the two tuples that are common to the two operand relations operand relations

It is denoted by ∏.It is denoted by ∏. Result of Drama ∏ Song will beResult of Drama ∏ Song will be

Roll NoRoll No NameName AgeAge

1313 kushkush 1515

Page 57: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

END

Page 58: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

The Join operationThe Join operation The join operation joins two relations to form a The join operation joins two relations to form a

new relation on the basis of common column the new relation on the basis of common column the two operand relations have.two operand relations have.

SuppliersSuppliers

Supp# Supp-Name Status City

S1 Britannia 10 Delhi

S2 New Bakery 30 Mumbai

S3 Mother Dairy 10 Delhi

S4 Cook 50 Bangalore

S5 Haldiram 40 Jaipur

Page 59: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

Clients relationClients relation

Clients#Clients# Client-NameClient-Name CityCity

C101C101 ABC Co.ABC Co. DelhiDelhi

C102C102 XYZ Co.XYZ Co. JaipurJaipur

C104C104 Zigs Co.Zigs Co. JaipurJaipur

If tables suppliers and Clients are joined If tables suppliers and Clients are joined over City columns ; the results will beover City columns ; the results will be

Page 60: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

Supp#

Supp-Name

Status

City Clients#Clients# Client-Client-NameName

CityCity

S1 Britannia 10 Delhi C101C101 ABC Co.ABC Co. DelhiDelhi

S3 Mother Dairy

10 Delhi C104C104 Zigs Co.Zigs Co. JaipurJaipur

S5 Haldiram 40 Jaipur C102 XYZ Co. Jaipur

S5 Haldiram 40 C104 C104 Zigs Co. Jaipur

Page 61: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

Type of JoinsType of Joins

1.Inner or equi –join: Inner join is used to 1.Inner or equi –join: Inner join is used to give matching records from joined tables.give matching records from joined tables.

Normalization:Normalization: It is a process by which one It is a process by which one goes from to another preferable form goes from to another preferable form through a set of rule and observations.through a set of rule and observations.

The objective of normalization on tables is The objective of normalization on tables is to remove the redundancy of data.to remove the redundancy of data.

First normal form:First normal form: A relation R is in First A relation R is in First Normal form(1NF) if and only if all Normal form(1NF) if and only if all underlying domains of the relation atomic underlying domains of the relation atomic (indivisible) values.(indivisible) values.

Page 62: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

In every tuples of the relation R, no In every tuples of the relation R, no attribute should have repeating attribute should have repeating groups.groups.

In every tuple of the relation R, In every tuple of the relation R, each attribute must have a value each attribute must have a value and that too an atomic(indivisible) and that too an atomic(indivisible) valuesvalues

Method of Bringing Unnormalized Method of Bringing Unnormalized Relation into 1NFRelation into 1NF

1.Remove all repeating groups from 1.Remove all repeating groups from the relationthe relation

2. Decompose non-atomic attributes 2. Decompose non-atomic attributes to atomic attributes.to atomic attributes.

Page 63: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

StudentStudent

StuStud#d#

NameName SubjectSubject

101101 ShobhitShobhit EnglishEnglish

MathsMaths

BiologyBiology

102102 UpasanUpasanaa

EconomiEconomicscs

EnglishEnglish

HindiHindi

StuStud#d#

NameName SubjecSubjectt

101101 ShobhitShobhit EnglisEnglishh

101101 ShobhitShobhit MathsMaths

101101 ShobhitShobhit BiologBiologyy

102102 UpasanUpasanaa

EconoEconomicsmics

102102 UpasanUpasanaa

EnglisEnglishh

102102 UpasanUpasanaa

HindiHindi

Page 64: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

Second Normal Form(2NF)Second Normal Form(2NF) Functional Functional

Dependence: Dependence: Functional Dependence is a relationship that exists between any two fields.

JK(K is functionally dependent on j)

JL(L is not functionally dependent on j)

JJ KK LL

XX 11 00

XX 11 66

YY 44 11

YY 44 99

ZZ 33 55

Page 65: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

Second Normal Form(2NF):Second Normal Form(2NF): A relation R A relation R is in Second Normal form(2NF) if and only is in Second Normal form(2NF) if and only if it is 1NF and every non-key attribute is if it is 1NF and every non-key attribute is fully dependent on the primary key.fully dependent on the primary key.

An attribute is a non-key if it does not An attribute is a non-key if it does not participate in the primary key.participate in the primary key.

Partial dependencePartial dependence means a non-key means a non-key attribute is dependent upon a portion of attribute is dependent upon a portion of the composite-primary- key and not the the composite-primary- key and not the whole primary key.whole primary key.

Fully functional dependency:Fully functional dependency: A FD X A FD X Y is a fully FD if remove of any attribute A Y is a fully FD if remove of any attribute A from X means that the dependency does from X means that the dependency does not hold good any more.not hold good any more.

Page 66: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

TeacherTeacher

T-NameT-Name SubjectSubject Child Child NameName

Child Child AgeAge

Child Child SexSex

GurindeGurinderr

Comp.SComp.Scc

SaranSaran 55 FF

AnandAnand ElectroElectronicsnics

VivekVivek 77 MM

ShridhaShridharr

PhysicsPhysics SandhySandhyaa

44 FF

MayaMaya Comp.SComp.Scc

VinayakVinayakaa

77 MM

MayaMaya Comp.SComp.Scc

SangeeSangeetata

55 FF

MayaMaya Comp.SComp.Scc

AnanthAnanth 33 MM

Page 67: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

Teacher Child

T-NameT-Name SubjectSubject

GurindeGurinderr

Comp.ScComp.Sc

AnandAnand ElectronicElectronicss

ShridhaShridharr

PhysicsPhysics

MayaMaya Comp.ScComp.Sc

T-T-NameName

Child Child NameName

ChilChild d AgeAge

ChilChild d SexSex

GurinGurinderder

SaranSaran 55 FF

AnanAnandd

VivekVivek 77 MM

ShridShridharhar

SandSandhyahya

44 FF

MayaMaya VinayVinayakaaka

77 MM

MayaMaya SangeSangeetaeta

55 FF

MayaMaya AnantAnanthh

33 MM

Page 68: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

The third Normal Form:The third Normal Form: A Relation A Relation R is said to be in Third Normal R is said to be in Third Normal Form(3NF) if and only if it is in 2NF Form(3NF) if and only if it is in 2NF and every non-key attribute is non-and every non-key attribute is non-transitively dependent upon the transitively dependent upon the primary keyprimary key

Every non-key attribute depends upon Every non-key attribute depends upon the primary key.the primary key.

TeacherTeacherT-NameT-Name SubjectSubject ClassesClasses

GurinderGurinder Comp.ScComp.Sc 55

AnandAnand ElectronicsElectronics 44

ShridharShridhar PhysicsPhysics 55

MayaMaya Comp.ScComp.Sc 22

Page 69: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

Teacher SbclTeacher Sbcl

T-NameT-Name SubjectSubject

GurinderGurinder Comp.ScComp.Sc

AnandAnand ElectronicElectronicss

ShridharShridhar PhysicsPhysics

MayaMaya Comp.ScComp.Sc

SubjectSubject ClassesClasses

Comp.ScComp.Sc 55

ElectronicElectronicss

44

PhysicsPhysics 55

Comp.ScComp.Sc 22

Page 70: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

Boyce- Codd Normal Boyce- Codd Normal Form(BCNF): Form(BCNF): A relation is in A relation is in BCNF if it is in 3NF and all of its BCNF if it is in 3NF and all of its determinants (i.e. the attributes determinants (i.e. the attributes upon which other attributes upon which other attributes depend) are candidate key (i.e. depend) are candidate key (i.e. the attributes that posses the the attributes that posses the properties to be a primary key properties to be a primary key but could not have been chosen but could not have been chosen as keys).as keys).

Page 71: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

Fields – different types of data (number or text)

RecordsQueries Reports

Page 72: A database consists of an organized collection of interrelated data for one or more uses, typically in digital form. Digital databases are managed using.

Searching for novel patterns, rules or relationships in data, e.g.:

•correlations•classification•clustering •visualization

Versus traditional statistics: hypothesis testingStates Data Mart - Cognos