Db Concepts2
-
Upload
guest319770 -
Category
Technology
-
view
678 -
download
1
description
Transcript of Db Concepts2
MG/DB CONCEPTS/CL12
DATABASE CONCEPTS
DATABASE
An electronic filing cabinet
A repository for a collection of computerized data files
A collection of persistent data that is used by the application system of some given enterprise
The term enterprise is a generic term for any self-contained commercial, scientific, technical or other organization
MG/DB CONCEPTS/CL12
DATABASE SYSTEM
A computerized record-keeping system. A database system involves four major components: data, hardware(secondary storage devices, processor(s) and associated main memory etc.,), software(the DBMS) and users(application programmers, end users, database administrator).
MG/DB CONCEPTS/CL12
Data independence
The ability to modify the scheme definition in one level without affecting the scheme definition in the next higher level is called data independence. Physical data independence :
refers to the ability to modify the scheme followed at the physical level without affecting the scheme followed at the conceptual level i.e., the application programs remain the same even though the scheme at physical level gets modified.
Logical data independence :
refers to the ability to modify the conceptual scheme without causing any changes in the schemes followed at view level.
MG/DB CONCEPTS/CL12
Data models
The hierarchical model
The network model
The relational model
MG/DB CONCEPTS/CL12
The hierarchical modelThe oldest model and is popular on main frames
Represents data by a collection of records organized in the form of a tree structure
Relationships among data are represented by links
The record at the top of the tree is the root
The hierarchy is maintained in the form of nodes and branches
The root may have any number of dependents, each of these dependents may have any number of lower level dependents and so on to any number of levels
MG/DB CONCEPTS/CL12
Consider a student course-marks database.
In the hierarchical model, a student can register for many courses and get marks for each course.
Scode SnameScode Sname
Ccode Cname Marks
C1 Physics 65
C2 Chemistry 78
C3 Maths 83
C4 CompSc 85
S2 BS1 A
Ccode Cname Marks
C3 Maths 83
C4 CompSc 85
MG/DB CONCEPTS/CL12
The student record is called as root.
It has got a course-marks record that is called the child record.
A parent can have many children.
A child cannot have more than one parent and no child can exist without its parent.
In this type of model following possibilities exist.Insert : Since no child record can exist without its parent, it is not possible to insert a new course details without introducing a dummy student
Delete : If a course is selected by only one student, then deleting that student will automatically delete all info about the course
Update : To change the course name of one course, the whole database has to be searched. This may result in data inconsistency.
MG/DB CONCEPTS/CL12
The network model
A NW model represents data by a collection of records and relationships among data are represented by links.
The student and course records are linked together through a marks record.
There are no restrictions on number of parents.
A record type can have any number of parent and child record types.
It is more complex than the hierarchical model because of links.
It can represent any structure designed in hierarchical model, and so is a superset of the hierarchical model.
MG/DB CONCEPTS/CL12
In network model following possibilities exist:
Insert
Inserting a course record or student record poses no problems as they can exist without any connectors till a student takes the course.
Delete
Deleting any record automatically adjusts the chain.
Update
Update can be done only to a particular child record
MG/DB CONCEPTS/CL12
The relational model
Developed by Codd
In relational model, data is organized into tables consisting of rows and columns
The table is referred to as a relation, the rows as tuples/records and columns as fields/attributes
A row in a table represents a relationship among a set of values
Since a table is a collection of such relationships, it is referred to as a relation
The relationships among data are represented by a collection of tables.
MG/DB CONCEPTS/CL12
Student tableMarks table
Scode Sname
S1S2
AB
Ccode Scode Marks
C1C2C3
S1S1S1
657883
C4C3C4
S1S2S2
858385
Course table
Ccode Cname
C1C2C3
PhysicsChemistryMaths
C4 Compsc
MG/DB CONCEPTS/CL12
Characteristics of a relation
There are no duplicate tuples
Tuples are not ordered
Attributes are not ordered
All attribute values are atomic
MG/DB CONCEPTS/CL12
Terminology
Cardinality
The number of tuples is called the cardinality
Degree
The number of attributes is called the degree
Domain
A pool of values from which specific attributes of specific relations draw their values.
A domain is just a data type
It provides a set of values from which various attributes in various relations take their actual values.
MG/DB CONCEPTS/CL12
Primary key
A column or a group of columns in a table that uniquely identifies records in the table.
It is a unique identifier for the table.
It contains unique value for each record.
Foreign key
A column or a group of columns in a table that is used to reference a primary key in another table.
MG/DB CONCEPTS/CL12
Database concepts (Revision)A database is a container for data
It is repository for storing organized information in the form of files
A db management system is a software package that handles the database
It is an interface between the user and the database
A DBMS organizes data as a data model
Data model is an infrastructure of data organization
MG/DB CONCEPTS/CL12
In a Relational Data Model, the data is organized into tables consisting of rows and columns
A table is referred to as a relation
The rows are referred to as tuples/records
The columns are referred to as fields / attributes
Primary key
A primary key is a unique identifier for the table
It consists of one/more attributes that uniquely identify each and every record in a table
It contains unique value for each record
MG/DB CONCEPTS/CL12
A database is a collection of tables
Tables consist of organized related information
Each table consists of a collection of records
Each record contains info about a specific entity
The info in each record is contained in fields
A field is the basic unit of a db
A field can contain text, numbers, dates or even photographs
MG/DB CONCEPTS/CL12
A data base system has 2 parts
The back end
The frond end
Front-end s/w interfaces with the user
Eg> Visual Basic
The back-end s/w holds data
Eg> IBM DB2, MS SQL SERVER, ORACLE, SYBASE, INFORMIX, MS ACCESS
MG/DB CONCEPTS/CL12
Structured Query Language(SQL) Enables you to create and operate on relational databases
A relational database is a collection of tables
Used for defining and manipulating relational databases
Non-procedural language
Format free language (Tabs, carriage return and spaces can be included anywhere in the statemen
Case insignificant
MG/DB CONCEPTS/CL12
The language consists of the following components:
Data definition component/language:
This component is used for defining and destroying objects like relations/tables, index etc
Eg> Create, alter, drop
Data manipulation component/language:
This component is used to retrieve and modify data.
It contains retrieval, manipulation and update directives
Eg> select, insert/delete, update
MG/DB CONCEPTS/CL12
Data control component:
Used for defining security and access control of the database.
Allows the user to grant access privileges.
Eg> grant, revoke