Database: Collection of well organized interrelated data stored together to serve many applications.

Similar documents
Session Chapter 11: Database Concepts

ASSIGNMENT NO Computer System with Open Source Operating System. 2. Mysql

BHARAT SCHOOL OF BANKING- VELLORE-1 DATABASE MANAGEMENT SYSTEM Overview of Database

Normalization in DBMS

8) A top-to-bottom relationship among the items in a database is established by a

Normalization Rule. First Normal Form (1NF) Normalization rule are divided into following normal form. 1. First Normal Form. 2. Second Normal Form

Unit IV. S_id S_Name S_Address Subject_opted

Visit for more.

RDBMS. SQL is Structured Query Language, which is a computer language for storing, manipulating and retrieving data stored in a relational database.

Distributed Database Systems By Syed Bakhtawar Shah Abid Lecturer in Computer Science

Techno India Batanagar Computer Science and Engineering. Model Questions. Subject Name: Database Management System Subject Code: CS 601

B.H.GARDI COLLEGE OF MASTER OF COMPUTER APPLICATION. Ch. 1 :- Introduction Database Management System - 1

DATABASE MANAGEMENT SYSTEM SHORT QUESTIONS. QUESTION 1: What is database?

Relational Database Management Systems Oct I. Section-A: 5 X 4 =20 Marks

Basant Group of Institution

Mahathma Gandhi University

Review for Exam 1 CS474 (Norton)

COSC344 Database Theory and Applications. σ a= c (P) Lecture 3 The Relational Data. Model. π A, COSC344 Lecture 3 1

The DBMS accepts requests for data from the application program and instructs the operating system to transfer the appropriate data.

CS403- Database Management Systems Solved Objective Midterm Papers For Preparation of Midterm Exam

DC62 Database management system JUNE 2013

Chapter 11 Database Concepts

II B.Sc(IT) [ BATCH] IV SEMESTER CORE: RELATIONAL DATABASE MANAGEMENT SYSTEM - 412A Multiple Choice Questions.

Relational Database design. Slides By: Shree Jaswal

A7-R3: INTRODUCTION TO DATABASE MANAGEMENT SYSTEMS

DBMS. Relational Model. Module Title?

Databases. Relational Model, Algebra and operations. How do we model and manipulate complex data structures inside a computer system? Until

2.2.2.Relational Database concept

UNIT 3 DATABASE DESIGN

U1. Data Base Management System (DBMS) Unit -1. MCA 203, Data Base Management System

Normalization. Murali Mani. What and Why Normalization? To remove potential redundancy in design

CS403- Database Management Systems Solved MCQS From Midterm Papers. CS403- Database Management Systems MIDTERM EXAMINATION - Spring 2010

King Fahd University of Petroleum and Minerals

Relational Model History. COSC 416 NoSQL Databases. Relational Model (Review) Relation Example. Relational Model Definitions. Relational Integrity

The Relational Model. Chapter 3. Comp 521 Files and Databases Fall

B.C.A DATA BASE MANAGEMENT SYSTEM MODULE SPECIFICATION SHEET. Course Outline

LAB 3 Notes. Codd proposed the relational model in 70 Main advantage of Relational Model : Simple representation (relationstables(row,

Database Management Systems Paper Solution

Database Systems Concepts *

THE RELATIONAL DATABASE MODEL

Vendor: CIW. Exam Code: 1D Exam Name: CIW v5 Database Design Specialist. Version: Demo

DATABASE MANAGEMENT SYSTEM

1. Considering functional dependency, one in which removal from some attributes must affect dependency is called

Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 10-2

Database Management System 9

Databases 1. Daniel POP

CISC 3140 (CIS 20.2) Design & Implementation of Software Application II

Chapter 10. Normalization. Chapter Outline. Chapter Outline(contd.)

Chapter 10. Chapter Outline. Chapter Outline. Functional Dependencies and Normalization for Relational Databases

Solved MCQ on fundamental of DBMS. Set-1

Exact Numeric Data Types

Database Management Systems

Data about data is database Select correct option: True False Partially True None of the Above

Comparison of File System vs Database Systems (Limitations to File System)

Informal Design Guidelines for Relational Databases

Chapter. Relational Database Concepts COPYRIGHTED MATERIAL

Database Technology Introduction. Heiko Paulheim

The Relational Model. Chapter 3

EECS 647: Introduction to Database Systems

Data, Databases, and DBMSs

The Relational Model. Chapter 3. Database Management Systems, R. Ramakrishnan and J. Gehrke 1

Detailed Data Modelling. Detailed Data Modelling. Detailed Data Modelling. Identifying Attributes. Attributes

The Relational Model. Chapter 3. Comp 521 Files and Databases Fall

Department of Computer Science and Information Systems, College of Business and Technology, Morehead State University

The Relational Model 2. Week 3

Detailed Data Modelling: Attribute Collection and Normalisation of Data

1D D0-541 CIW v5 Database Design Specialist Version 1.7

DATABASE DEVELOPMENT (H4)

Teaching Scheme BIT/MMC/BCS Database Systems 1

KINGDOM OF SAUDI ARABIA-JAZAN UNIVERSITY COLLEGE OF COMPUTER SCIENCE & INFORMATION SYSTEMS 221 INFS 3 DATABASE SYSTEMS-1 REVIEW QUESTIONS

Chapter 4. The Relational Model

The Relational Data Model. Data Model

Introduction to Databases

Functional Dependencies and. Databases. 1 Informal Design Guidelines for Relational Databases. 4 General Normal Form Definitions (For Multiple Keys)

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Unit I. By Prof.Sushila Aghav MIT

Chapter 3B Objectives. Relational Set Operators. Relational Set Operators. Relational Algebra Operations

CT13 DATABASE MANAGEMENT SYSTEMS DEC 2015

Advance Database Management System

Applied Databases. Sebastian Maneth. Lecture 5 ER Model, normal forms. University of Edinburgh - January 25 th, 2016

Chapter 14. Database Design Theory: Introduction to Normalization Using Functional and Multivalued Dependencies

Database Applications (15-415)

Downloaded from

CS317 File and Database Systems

Applied Databases. Sebastian Maneth. Lecture 5 ER Model, Normal Forms. University of Edinburgh - January 30 th, 2017

MIDTERM EXAMINATION Spring 2010 CS403- Database Management Systems (Session - 4) Ref No: Time: 60 min Marks: 38

SQL Interview Questions

D.K.M COLLEGE FOR WOMEN(AUTONOMOUS),VELLORE DATABASE MANAGEMENT SYSTEM QUESTION BANK


CS2 Current Technologies Note 1 CS2Bh

In-Sem Paper Solution Subject: Database Management System (2015 Patter) August, Answer: [1]

The Relational Model

SQL Joins and SQL Views

ARTICLE RELATIONAL ALGEBRA

Introduction to Geographic Information Science. Updates. Last Lecture. Geography 4103 / Database Management

The functions performed by a typical DBMS are the following:

Part III. Data Modelling. Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 1

The Relational Model

DATABASE MANAGEMENT SYSTEMS

Today Learning outcomes LO2

Transcription:

RDBMS

Database: Collection of well organized interrelated data stored together to serve many applications. Database-management System(DBMS): Data Base Management System is a software that can be used to set up and monitor database, and can manage the updating and retrieval of data in a database. It is basically a computer based record keeping system. e.g. MS Access, dbase, foxpro, MY SQL etc.

Disadvantages of Traditional File Oriented Approach : The traditional file-oriented approach to information processing for each application has a separate master file and its own set of personal files. 1. Data redundancy and inconsistency: Different files may have different formats and the programs may be written in different programming languages as they are developed by different programmers. Moreover, the same information may be duplicated in several places (files). ( Duplication of data is know is data redundancy) For example, the address and telephone number of a particular customer may appear in a file that consists of saving-account records and in a file that consists of checking-account records. This redundancy leads to higher storage and access cost. It may lead to data inconsistency; that is the various copies of the same data may no longer agree.

Disadvantages of Traditional File Oriented Approach : 2. Data isolation: Since data is scattered in various files, which might be in different formats, it is difficult to write a new application to retrieve appropriate data. 3. Integrity Problems: The data values stored in the database must satisfy certain types of consistency constraints. 4. Security problems: Every person should not be allowed to access the database for security purposes. Since application programs are added to the system in an ad-hoc manner, it is difficult to ensure such security constraints.

Advantages provided by Database Management System: 1. DBMS reduces the Data Redundancy : AS all the data are kept at one place and all applications refers to same data centrally from a database, so redundancy gets controlled. 2. DBMS controls the Data inconsistency : Any change to be made to data is done at one place and all applications using this data, gets updated data. Thus updates are propagated automatically. 3. DBMS facilitate sharing of data: Sharing of data means individual pieces of data in the database may be shared among different users, can be used for different purposes. 4. Standards can be enforced: With central control of database, the DBA (Database Administrator) can ensure that the data represents all applicable standards like corporate, installation, departmental, industry, national and international standards etc. 5. Security restrictions can be applied: A DBA can ensure that the database is accessed only through proper channels and by authorised users. 6. Integrity can be maintained: The problem of integrity is the problem of ensuring that the data in the database is accurate and correct. Centralised control of DBMS help in avoiding the problem of inconsistency.

1. What is DBMS? DATABASE MANAGEMENT SYSTEM is a software used for management, maintenance and retrieval of data stored in a database. e.g : Oracle, MS-Access, SQL server etc. 2. What is a database system? What is its need? 3. Can you think of disadvantages of using a database system? What are they? Ans. As database system perform complex tasks it may lead to some risks and disadvantages due to certain things during operation on data. These are: Security may be compromised without good controls. Integrity may be compromised without good controls. Extra hardware may be required. System likely to be complex. Performance may suffer

4. What is Data Abstraction? What are various levels of data abstraction in a database system? Data Abstraction: A good database system ensures easy, smooth and efficient data structures so that every type of database user: End User, Application System Analyst and Physical Storage System Analyst is able to access its desired information efficiently. Thus providing the essential details and hiding the background information is known as Data Abstraction.

Various levels of data abstraction in a database system: There are three levels of data abstraction: 1. Internal Level (Physical level) : this level describes how the data actually stored on the storage medium. Here complex data structures are defined. 2. Conceptual level(logical Level) :This level describes what data are actually stored and also describes its link to other data, and logical structures are defined here. 3. External level ( View Level): This level is concerned with the way data is viewed by individual users. Only essential features are provided.

4. What is Data Independence? What are various levels of data independence in a database system? Data Independence : The ability to modify a scheme definition in one level without affecting a scheme definition in the next level is called Data Independence. Since databases keeps on growing and hence leads to frequent changes at various levels but this should not lead to redesigning and reimplementation of the database.

Various levels of Data Independence in a database system: There are two levels of Data Independence : 1. Physical Data Independence: Ability to modify scheme at physical level without affecting the scheme followed at conceptual level. That is application programs remain the same even though the scheme at physical level gets modified. 2. Logical Data Independence : Ability to modify scheme at conceptual level without affecting the scheme followed at view level. Logical independence ensure that applications remain same. Modifications at the logical level are necessary whenever the logical structure of the database is altered. It is more difficult to achieve.

Database Model A Database model defines the logical design of data. The model describes the relationships between different parts of the data. Historically, in database design, three models are commonly used. They are: Hierarchical Model Network Model Relational Model

Hierarchical Model In this model each entity has only one parent but can have several children. At the top of hierarchy there is only one entity which is called Root.

Network Model In the network model, entities are organized in a graph, in which some entities can be accessed through several path

Relational Model In this model, data is organised in two-dimesional tables called relations. The tables or relation are related to each other. EMPID ENAME SAL HIRE_DATE DEPTNO 101 JOHN SMITH 10000 12-05-2000 10 102 AKASH DE 12000 25-10-2001 20 103 STEVE 15000 14-03-1999 10 DEPTNO DNAME DLOC 10 TEACHER BEAS 20 CLERK DLEHI

Codd's Rule E.F Codd was a Computer Scientist who invented Relational model for Database management. Based on relational model, Relation database was created. Codd proposed 12 rules popularly known as Codd's 12 rules to test DBMS's concept against his relational model. Codd's rule actualy define what quality a DBMS requires in order to become a Relational Database Management System(RDBMS). Till now, there is hardly any commercial product that follows all the 12 Codd's rules. Even Oracle follows only eight and half out(8.5) of 12

Normalization of Database Database Normalisation is a technique of organizing the data in the database. Normalization is a systematic approach of decomposing tables to eliminate data redundancy and undesirable characteristics like Insertion, Update and Deletion Anomalies. It is a multi-step process that puts data into tabular form by removing duplicated data from the relation tables. Normalization is used for mainly two purpose: Eliminating redundant(useless) data. Ensuring data dependencies make sense i.e data is logically stored.

Problem Without Normalization Without Normalization, it becomes difficult to handle and update the database, without facing data loss. Insertion, Updation and Deletion Anamolies are very frequent if Database is not Normalized. To understand these anomalies let us take an example of Student table. S_id S_Name S_Address Subject_opted 401 Adam Noida Bio 402 Alex Panipat Maths 403 Stuart Jammu Maths 401 Adam Noida Physics Updation Anamoly : To update address of a student who occurs twice or more than twice in a table, we will have to update S_Address column in all the rows, else data will become inconsistent. Insertion Anamoly : Suppose for a new admission, we have a Student id(s_id), name and address of a student but if student has not opted for any subjects yet then we have to insert NULL there, leading to Insertion Anamoly. Deletion Anamoly : If (S_id) 402has only one subject and temporarily he drops it, when we delete that row, entire student record will be deleted along with it.

Normalization rule are divided into following normal form. 1.First Normal Form 2.Second Normal Form 3.Third Normal Form 4.BCNF

Table Emp: Ename Eage DeptN Ajay, Vijay 40,41 Science, Comp Sc Edward 42 Clerk Obama 52 Medicine After First Normal Form: Ename Eage DeptN Ajay 40 Science Vijay 41 Comp Sc Edward 42 Clerk Obama 52 Medicine After 2 nd NF: Empid Ename Eage 001 Ajay 40 002 Vijay 41 003 Edward 42 004 Obama 52 Deptid DeptN 10 Science 20 Comp Sc 30 Clerk 40 medicine After 3rd NF: Empid Ename Eage Deptid 001 Ajay 40 10 002 Vijay 41 20 003 Edward 42 30 004 Obama 52 40 Deptid DeptN 10 Science 20 Comp Sc 30 Clerk 40 medicine

A domain is the original sets of atomic values used to model data. In data base management and database, a domain refers to all the possible unique values of a particular column. For example: i) The domain of gender column has a set of two possible values i.e, Male or Female. ii) The domain of marital status has a set of four possible values i.e, Married, Unmarried, Widows and Divorced. Therefore, a domain is a set of acceptable values of a particular column, which is based on various properties and data types.

Table/Relation In Relational database, a table is a collection of data elements organised in terms of rows and columns. A table is also considered as convenient representation of relations. But a table can have duplicate tuples while a true relation cannot have duplicate tuples. Table is the most simplest form of data storage. Below is an example of Employee table.

Relation In database, a relation means a 'table', in which data are organized in the form of rows and columns. Therefore in database, relations are equivalent to tables.

View: In SQL, a view is a virtual table derived from query of another table(base table). A view contains rows and columns, just like a real table. The fields in a view are fields from one or more real tables in the database.

Example : Consider the CUSTOMERS table having the following records +----+----------+-----+-----------+----------+ ID NAME AGE ADDRESS SALARY +----+----------+-----+-----------+----------+ 1 Ramesh 32 Ahmedabad 2000.00 2 Khilan 25 Delhi 1500.00 3 kaushik 23 Kota 2000.00 4 Chaitali 25 Mumbai 6500.00 5 Hardik 27 Bhopal 8500.00 6 Komal 22 MP 4500.00 7 Muffy 24 Indore 10000.00 +----+----------+-----+-----------+----------+ SQL > CREATE VIEW CUSTOMERS_VIEW AS SELECT name, age FROM CUSTOMERS; name age +----------+-----+ Ramesh 32 Khilan 25 kaushik 23 Chaitali 25 Hardik 27 Komal 22 Muffy 24

Horizontal subset/information in a table is called tuple. The tuple is also known as a 'record', which gives particular information of the relation (table).

Keys are an important part of a relational database and a vital part of the structure of a table. They help enforce integrity and help identify the relationship between tables. There are FOUR main types of keys -candidate keys, primary keys, foreign keys and alternate keys. Primary Key: A column that uniquely identifies a row within a table is called primary key.( IT CAN NOT BE BLANK AND DUPLICATE- Entity Integrity) Candidate Key: Candidate keys are set of fields (columns with unique values) in the relation that are eligible to act as a primary key. Alternate Key: Out of the candidate keys, after selecting a key as primary key, the remaining keys are called alternate key. Foreign Key: A foreign key is a field (or collection of fields) in one table that uniquely identifies a row of another table. In other words, a foreign key is a column or a combination of columns that is used to establish a link between two tables.

Non-key Attribute Non-key attributes are attributes other than candidate key attributes in a table. Non-prime Attribute Non-prime Attributes are attributes other than Primary attribute.

Data Integrity : It means that we can correctly and consistently navigate and manipulate the tables in database. There are two basic rules to ensure data integrity- 1. Entity Integrity: It states that value of primary key can not be null and duplicate i.e. it should be unique for each row. 2. Referential Integrity: It states that if a relation in database has foreign key, then every value of the foreign key must be either null or match the values in the relational table in which that foreign key is a primary key.

Q Differentiate between Primary Key, Candidate Key and alternate key in context with RDBMS, and give suitable example. Admno RollNo Name Marks 786 1 Gurpreet Singh 85 1011 2 Gurpreet Singh 75 1083 3 Radhe Krishna 63 9993 4 Sukhi Bajwa 85 1526 5 Zoya Kapoor 95

Degree of relation: Total Number of attributes in a relation are called its degree. Cardinality: Total Number of rows in a relation.

E-R Diagram ER-Diagram is a visual representation of data that describes how data is related to each other.

Symbols and Notations

A Relationship describes relations between entities. Relationship is represented using diamonds.

Relational Algebra Relational Algebra is theoretical procedural query language, which takes Relation as input and generate relation as output Few Fundamental Operations are: 1. SELECT 2. PROJECT 3. UNION 4. CARTESIAN PRODUCT 5. SET INTERSECTION 6. SET DIFFERENCE

1 The select operation: - to identify a set of tuples(horizontal subset) which is a part of a relation and to extract only these tuples out. The select operation selects tuples that satisfy a given predicate or condition. It is a unary operation defined on a single relation. It is denoted as σ.

2 The Project operation:

3 Union Operation ( ) It performs binary union between two given relations and is defined as r s For a union operation to be valid, the following conditions must hold 1. r, and s must have the same number of attributes. 2. Attribute domains must be compatible. 3. Duplicate tuples are automatically eliminated. Song Rollno Name S001 Rohit S002 Baby S003 Abinav Drama Rollno Name S006 Manya S002 Baby S008 Akash Song U Drama Rollno Name S001 Rohit S002 Baby S003 Abinav S006 Manya S008 Akash

4 Cartesian Product (Χ) Combines information of two different relations into one.(rxs) The sum of the number of attributes of R and S is the number of attributes of the Cartesian product The product of the sizes of R and S in the number of rows. Instructor Student Stud_ID S001 S002 S003 Sname Rohit Baby Abinav InstID Iname Subj I01 K Pal Eng I02 S Arora IT Stud_ID Sname InstID Iname Subj S001 Rohit I01 K Pal Eng S001 Rohit I02 S Arora IT S002 Baby I01 K Pal Eng S002 Baby I02 S Arora IT S003 Abinav I01 K Pal Eng S003 Abinav I02 S Arora IT Student X Instructor Rows/tuples = 3x2=6 Attributes = 2+3=5 i.e. cardinality=6 degree =5

5 INTERSECTION: the INTERSECTION operation on a relation A INTERSECTION relation B, designated by A B, includes tuples that are only in A and B. In other words only tuples belonging to A and B, or shared by both A and B are included in the result. author (Books) author (Articles) SELECT dob From A INTERSECT SELECT dob from B

6. difference operation(minus): - finds tuples in one relation but not in other. SELECT dob From A MINUS SELECT dob from B