Docsity

RDBMS notes for mid sem exam preparation, Summaries of Relational Database Management Systems (RDBMS)

Partial preview of the text

Download RDBMS notes for mid sem exam preparation and more Summaries Relational Database Management Systems (RDBMS) in PDF only on Docsity!

DBMS MODULE 1

Database System Concepts and Data Models

Prepared by Jagannatha Tanty

Exam-oriented study notes • B.Tech CSE • Module 1

Copyright & Use Notice

This publication is an original, reformatted study guide prepared from the source notes supplied for this project. Before commercial distribution, the seller should confirm that the source notes and all included ideas, examples, figures and wording are owned by the seller or are used with permission. No third-party diagrams or copied page images from the source PDF are included in this edition.

This guide is intended for educational study and revision. Readers should verify software commands against the version of MySQL they use.

1. Introduction to Data, Database and DBMS

Data

Data is a collection of facts that can be recorded and that have implicit meaning. For example, customer information may include customer name, customer number and city.

Database

A database is an organized collection of structured information or data, typically stored electronically. A database is usually controlled by a Database Management System (DBMS).

Database Management System (DBMS)

A DBMS is software used for creating, managing and reading databases. It allows users and applications to access, update and interact with data while supporting security, consistency and efficient access.

Examples

MySQL, Microsoft SQL Server, Oracle Database and MongoDB (for NoSQL).

2. DBMS vs. File-Processing Systems

Problems with file-processing systems

Data redundancy and inconsistency; difficulty accessing specific data; difficulty maintaining data integrity; unsafe concurrent access; and limited security controls.

Advantages of DBMS

Data independence; concurrent access and crash recovery; efficient data access through query processing/optimization; data integrity and security; and reduced application-development effort.

3. Database Users

Database Administrator (DBA)

Defines the schema, controls the external, conceptual and internal levels, manages accounts and access, provides security, monitors backup and recovery, provides technical support, and helps recover from hardware or software failures.

Naive / Parametric End Users

Users who may have little DBMS knowledge but frequently use database applications to perform routine tasks, such as railway-ticket booking users or bank clerks.

System Analyst

Analyzes the requirements of end users and checks whether their requirements are satisfied.

Sophisticated Users

Engineers, scientists and business analysts who are familiar with databases and may develop applications or interact directly using SQL queries.

Database Designers

Design the database structure, including tables, indexes, views, constraints, triggers and stored procedures, and determine how data items are related.

Application Programmers

Computer professionals who write application programs using languages such as C, C++, Java and Python.

Casual / Temporary Users

Users who access a database occasionally, generally requiring new information each time, such as middle- or higher-level managers.

4. Data Abstraction

Meaning

Data abstraction hides unnecessary implementation details so that database systems are easier to use.

Physical / Internal Level

Describes how data is actually stored, including storage organization, indexes and data structures. It is concerned with performance and optimization.

Logical / Conceptual Level

Describes what data is stored and the relationships among entities, attributes and constraints. It provides the overall logical view of the database.

View / External Level

Shows only the required part of the database to a particular user. Different users can have different views, helping restrict unauthorized access.

5. Schema and Instance

Schema

The overall design or structure of a database. It acts like a blueprint and normally remains unchanged unless the database design is modified.

Types of Schema

Physical schema describes physical storage; logical schema describes tables, attributes and relationships; view schema describes how data is presented to users.

Instance

The actual data stored in the database at a particular moment. Unlike the schema, an instance changes frequently through insert, update and delete operations.

6. Data Independence

Meaning

Data independence is the ability to change the schema at one level without affecting the schema at the next higher level.

A client-server model in which the client application communicates directly with the database server using interfaces such as ODBC or JDBC. The client handles the interface/application while the server handles query processing, transactions and storage.

3-Tier Architecture

An application-server layer is placed between the client and database server. The client sends requests to the application server, which processes them and communicates with the database. It is commonly used for large web applications.

3-Tier advantages

Enhanced scalability, better security and support for data integrity through the intermediate layer.

3-Tier disadvantages

Greater complexity, more difficult management, possible additional response time and higher infrastructure/personnel cost.

9. Building a DBMS

Step 1 — Requirement Analysis

Identify the data that must be stored, such as student or employee records.

Step 2 — Design Database Schema

Create the database blueprint containing tables, fields and relationships.

Step 3 — Choose DBMS Software

Examples include MySQL, Oracle and PostgreSQL.

Step 4 — Implement the Database

Create tables and define constraints.

Step 5 — Load Data

Insert data into the tables.

Step 6 — Access and Manage Data

Use SQL queries to insert, update, delete and retrieve data.

10. MySQL Installation and Basic SQL

Installation

The notes specify installing MySQL Community Server, Shell and Workbench from the MySQL official site. On Windows, the MySQL bin directory can be added to environment variables if required. The MySQL service can be started/connected using the command shown in the source notes.

Create Database

CREATE DATABASE SchoolDB;

Use Database

USE SchoolDB;

Create Table

CREATE TABLE Students ( StudentID INT PRIMARY KEY, Name VARCHAR(50), Age INT, Grade VARCHAR(10) );

Insert Data

INSERT INTO Students (StudentID, Name, Age, Grade) VALUES (1, 'Rahul Sharma', 20, 'A');

Select Data

SELECT * FROM Students;

Delete Data

DELETE FROM Students WHERE StudentID = 1;

Drop Table

DROP TABLE Students;

Drop Database

DROP DATABASE SchoolDB;

11. Keys in DBMS

Meaning

A key is an attribute or set of attributes used to uniquely identify a row in a relation. Keys help identify records, establish relationships and support data integrity.

Why keys are needed

They uniquely identify rows, help prevent duplication, establish relationships between tables, and support identity and integrity.

Candidate Key

A minimal set of attributes that uniquely identifies each row. A table may have multiple candidate keys; one is selected as the primary key. Candidate keys must provide uniqueness and are treated as non-null identifiers in the source notes.

Super Key

A set of one or more attributes that uniquely identifies a row. It may contain extra attributes. Every candidate key is a super key, but not every super key is a candidate key.

Primary Key

The selected key used to uniquely identify each row. A table has one primary-key constraint, which can consist of one or more columns. It must be unique and cannot contain NULL.

Alternate Key

A candidate key that is not selected as the primary key. It can still uniquely identify records.

Foreign Key

An attribute or set of attributes in one table that refers to a primary key in another table. The child/referencing table contains the foreign key; the parent/referenced table contains the referenced

Key Comparison Table

Key Purpose / Characteristic Candidate Key Minimal attribute set that uniquely identifies a row. Super Key Uniquely identifies a row; may contain extra attributes. Primary Key Selected key used as the main unique identifier; cannot be NULL. Alternate Key Candidate key not selected as the primary key. Foreign Key References a key in another table and establishes a relationship. Composite Key Uses two or more attributes together to identify a row.

Source basis: the supplied 19-page RDD Module 1 notes covering database concepts, users, abstraction, schema/instances, data independence, data models, DBMS architecture, building a DBMS, MySQL basics, keys and referential integrity. nfilecitenturn3file0nL10-L22n nfilecitenturn3file0nL24-L46n