Beruflich Dokumente
Kultur Dokumente
Basic concepts and important terms Importance of Database Design stages of DBMS At least one database tool i.e. Ms-Access
REFERENCES
Fundamentals of Database Systems Remez Al-Masri, S. B. N., Pearson Education Inc. Database Systems Thomas Connolly Second Edition Addison Wesley Introduction to database systems C-J. Date 7th Edition Addison Wesley
You will be able to understand the definition of Data, Data file and Database Applications of Databases in the Real-world scenarios Why we design and use database?
What is Data?
These are the raw facts of anything that can be recorded and stored. It may be about living or non-living objects.
Represented in the form of symbols, words or pictures.
Common Types:
1. 2.
3.
4.
Numerical e.g. 120, -70, $400, 35.75 Character/Strings e.g. Name, Address Voice Pictures and graphs
A collection of related data items stored in one place against a suitable but valid name.
For example: Personal Data related to students of BBA class (Semester I) i.e. Name: ------Age: -------Cell #: -----Address:
Data processing and File Processing These environments are created for getting the required information according to the point of view of the user. e.g. Merit list of selected candidates
Some Computer Language/software is required to manipulate the data for obtaining the useful information.
What is a Database ?
Common Definition: A Database is a shared collection of logically related data that is stored on a media to meet the requirements of different users of an organization.
Shift from computation to information at the low end: scramble to webspace (a mess!) at the high end: scientific applications Datasets increasing in diversity and volume. Digital libraries, Population Data, Banking systems, interactive video, Human Genome project, EOS project ... need for DBMS exploding
Real-world Applications
1.
2.
3.
4. 5.
6.
7.
Commercial Applications e.g. Accounting, Banking systems, reservation systems Engineering Systems Social sciences Medical sciences Educational Systems Linguistics Word Processing ( Dictionary)
Data Models
An integrated collection of concepts for describing: data relationships between data constraints on the data in an organization
A schema is a description of a particular collection of data, using the a given data model. The relational model of data is the most widely used model today. Main concept: relation, basically a table with rows and columns. Every relation has a schema, which describes the columns, or fields.
1960s
Diagram
1970s
1980s
1990s
2000+
?
Hierarchical Object
Traditional Files
Relational
Network
Object-Relational
A schema is a description of a particular collection of data, using the a given data model. Meta-data: The information stored in the catalog is called meta-data. It is all about data that describes properties or characteristics of data The catalog is used by the DBMS software
Schema diagram
DIAGRAM
STUDENT
address cellno
Courseno
SECTION
prerequisteno
Relational Model
The relational model of data is the most widely used model today. Main concept: relation, basically a table with rows and columns. Every relation has a schema, which describes the columns, or fields.
Advantages of DBMS
The data can be shared Redundancy can be reduced Data inconsistency can be avoided Transaction support can be provided Integrity can be maintained Security can be enforced Conflicting requirements can be balanced Standards can be enforced
Disadvantages of DBMS
Complexity Size Cost of DBMS Additional hardware costs Cost of conversion Performance Higher impact of a failure
EXAMPLE: DBMS
Data definition Data Manipulation Optimization and Execution Data Security and Integrity Data recovery and concurrency Data Dictionary Performance
Key terms
If you have mastered this topic, you should be able to use the following terms correctly in your assignments and exams: Instance Domain Degree Cardinality Referential integrity
Domain Set of allowable values for one or more attributes. Attribute values are (normally) required to be atomic, that is, indivisible
E.g. multi-valued attribute values are not atomic E.g. composite attribute values are not atomic
Continued
Relation Instance The current values (relation instance) of a relation are specified by a table Cardinality The number of tuple (s) in a relation. Relational Database A collection of normalized relations with distinct relation names.
Continued .
Superkey or Primary Key An attribute, or a set of attributes, that uniquely identifies a tuple within a relation. Let K R
K is a superkey of R if values for K are sufficient to identify a unique tuple of each possible relation (R)
{customer-name} are both superkeys of Customer relation, if no two customers can possibly have the same name.
DBMS Languages
DDL: Data definition language is used by the DBA and by the database designers to define both schemas (Conceptual and Internal). DML : Data manipulation language is used when the database schemas are compiled and it is populated with data. Typical manipulation s include retrieval, insertion, deletion, and modifications of the data.
Customer table
attributes (or columns) customer-name customer-Zone Younas Ahsan Mohsen Uzma Main M-I M-I G-II customer customer-city Kasur Lahore Lahore Gujranwala
Database Architecture
Why we need a Standardized Architecture? Three Level Architecture At what level we interact with the system? Different Users ( Nave user, Designer/Programmer, DBA) interact at different levels Main objective: separate the user view from physical view, Example: DoB
Objectives
1. 2. 3. 4.
Separate User View from physical view Different views of the same data Consolidated representation Both ways easy change
1. 2.
3.
Three Schema OR Three Models External View = Level I = Virtual/Calculated Data Conceptual View = Logical View/ Schema Middle layer = Level - II Internal / Physical View = Level III = Bottom Layer (Permanent Structure of the data)
At this level, the calculated data is shown in the way the user view the data. It is not actually stored in the database but is created when needed e.g. Age, Name, Any statistical data etc. DBMS uses the external view to create user Interface for different users which is both the facility and control / barrier
Level - I
External Level
It is the individual user level An individual users view is an external view The user can be either an application programmer or an end user An external view is the content of the database as seen by Particular user. This level describes that part of database that is relevant to a particular user Each external view is defined by an external schema The external schema is written using the external DDL-Data Definition Language
A complete description of the information content of the database i.e. Entire information of the data and its structure (DBA) In terms of Conceptual Schema, The records containing all entities, attributes, their relationships and constraints on the data. It is semantically designed with the present needs as well as future needs of an organization
Level II Continued
Conceptual Level
A representation of the entire information content of the database. Called community view of the database. Describes what data is stored in database and relationships among the data. Conceptual view is defined by the conceptual schema Conceptual schema is written using the conceptual DDL.
It is concerned about the physical implementation of the database. DBMS chooses and represent the type of data and its structure Lays out data on the storage device with the help of Operating System OR SDL ( Storage Definition Language).
Internal Level It is the low-level representation of the entire database. Describes how the data is stored in the database. Physical representation of the database on the computer. The internal view is described by the internal schema The internal schema is written using the internal DDL or SDL.
Conceptual schema:
Students(sid: string, name: string, login: string, age: integer, gpa:real) Courses(cid: string, cname:string, credits:integer) Enrolled(sid:string, cid:string, grade:string) Relations stored as unordered files. Index on first column of Students. Course_info(cid:string,enrollment:integer)
Physical schema:
DBMS Environments
1. 2.
RDBMS- Relational Database Management system. It is mainly used to store and manipulate large amount of data according to the relational data model. Single User environment Multi-user environment