0% found this document useful (0 votes)
12 views

Unit 4-7

Uploaded by

sivasakethram
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Unit 4-7

Uploaded by

sivasakethram
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 53

10213GE103

Software Development
and Maintenance
Dr M Sadish Sendil

UNIT 4
COURSE CODE COURSE TITLE L T P C

10213GE103 Software Development and 3 0 0 3


Maintenance

Prerequisite: 10210CS101 - Problem Solving using C.

Preamble:
This course provides basic concepts about SDLC, Unix commands and shell operations, Object Oriented Programming,
JavaScript technologies to create the interactive client-side design of web applications.
This course introduces DBMS concepts, to share a common set of models, design paradigms via a Structured Query Language
(SQL).
More specifically, this course also deals with UI/UX concepts to develop a pleasant user interface and deploy the application
using Cloud AWS services
Course Objectives
Learners are exposed to:
• Make use of basic SDLC, Unix Commands.
• Practice Java basic constructs for real world problems.
• Build efficient client-side validation using javascript.
• Acquire knowledge on basic SQL queries and designing database schema
• Learn and build the workflow of UI/UX
• Deploy the application on AWS cloud
Course Outcomes
Upon the successful completion of the course, students will be able to:

CO Course Outcomes K - Level


No’s
CO1 Interpret the Software Development Life Cycle (SDLC) K2
stages, Unix basics commands and shell operations, and
OOP.
CO2 Articulate proficiency in exception handling, inheritance, K3
and API fundamentals.
CO3 Design the interactive and dynamic webpage using K3
JavaScript.
CO4 Model the Relation Database schema and perform CRUD K3
operations.
CO5 Chart UI/UX and deploy the applications using AWS K3
cloud.
Knowledge Level (Based on revised Bloom’s Taxonomy)
K1-Remember K2-Understand K3-Apply K4-Analyze K5-Evaluate K6-Create
Unit 4 Database Fundamentals: RDBMS, SQL
DBMS: History of Data and its definition - Various formats to recognize
databases - DBMS through MySQL Workbench - DBMS Types and its
features - Requirements of DBMS - Roles, job-related tasks.
RDBMS: Introduction and its uses - popular RDBMS and their uses - Oracle
RDBMS versions and features - SQL Server RDBMS, history and its features
- MySQL RDBMS, history and its features - MySQL Workbench -
Normalization - E.F. Codd.
SQL: Introduction - Connectivity - Reserved words - Data Types – SQL
Commands: DDL - Alter tables - drop and truncate - table constraints -
constraint violation
History of Data and its definition
History of Data and its definition
 Data is a collection of facts and figures.
 The data collection was increasing day to day and they needed to be
stored in a device or a safer software.
 Charles Bachman was the first person to develop the Integrated Data
Store (IDS) which was based on a network data model for which he was
inaugurated with the Turing Award (The most prestigious award which is
equivalent to the Nobel prize in the field of Computer Science.).
 It was developed in the early 1960s. In the late 1960s, IBM
(International Business Machines Corporation) developed the
Integrated Management Systems which is the standard database
system used to date in many places.
 It was developed based on the hierarchical database model. It was during
the year 1970 that the relational database model was developed by
Edgar Codd.It was considered the standardized database model from
then.
 The relational model was still in use by many people in the market. Later
during the same decade (1980’s), IBM developed the Structured Query
History of Data and its definition
 A database management system (DBMS) allows a person to organize,
store, and retrieve data from a computer. It is a way of communicating
with a computer’s “stored memory.”
 In the very early years of computers, “punch cards” were used for input,
output, and data storage.
 Punch cards offered a fast way to enter data and retrieve it. Herman
Hollerith is given credit for adapting the punch cards used for weaving
looms to act as the memory for a mechanical tabulating machine, in 1890.
Much later, databases came along.
 Databases (or DBs) have played a very important part in the recent
evolution of computers.
 The first computer programs were developed in the early 1950s and
focused almost completely on coding languages and algorithms.
 At the time, computers were basically giant calculators and data (names,
phone numbers) was considered the leftovers of processing information
https://www.dataversity.net/brief-history-database-management/
Various formats to recognize databases
Recognizing Databases: Various Formats and Techniques
Recognizing databases involves identifying their specific format or structure. This can be crucial
for data analysis, migration, or integration tasks. Here are some common formats and techniques
used to recognize databases:
1. File Extensions:
•Relational Databases:
•.mdb (Microsoft Access)
•.accdb (Microsoft Access 2007+)
•.sql (SQL Server, MySQL, PostgreSQL, etc.)
•.sqlite (SQLite)
•NoSQL Databases:
•.json (MongoDB, Couchbase)
•.bson (MongoDB)
•.avro (Apache Avro)
•.parquet (Apache Parquet)
Various formats to recognize databases
2. Database Management Systems (DBMS) Signatures:
•DBMS-specific headers or footers: These can be used to identify the
DBMS used to create the database.
•Database-specific commands or syntax: Analyzing the SQL
statements or query language can reveal the underlying DBMS.
3. Data Structure and Content Analysis:
•Schema analysis: Examining the database schema (tables, columns,
data types, relationships) can provide clues about the database format.
•Data content analysis: Analyzing the data within the database can
help identify patterns and characteristics associated with specific
database types.
4. Database Metadata:
•Metadata files: Some databases store metadata in separate files that
can be used to identify the format.
•Database catalogs: Many DBMSs have catalogs that contain
information about the database structure and metadata.
Type of DBMS Features
Relational DBMS (RDBMS) use of a primary key and foreign keys to establish
relationships between tables. A primary key is a unique
identifier for each record in a table, and a foreign key is a
reference to the primary key of another table. This allows for
the creation of relationships between tables, such as one-to-
one, one-to-many, and many-to-many.
Object-oriented DBMS (OODBMS) the ability to model complex relationships and hierarchies
within the data. For example, an OODBMS can model an object
such as a car, which has properties such as make, model, and
year, and methods such as start and stop. It can also model
relationships between objects, such as a car having a one-to-
many relationship with its parts.
Hierarchical DBMS (HDBMS) The hierarchical model is closely related to the tree data
structure, with the parent-child relationship being similar to
the parent-child relationship between nodes in a tree. The
data is stored in a tree-like structure, with each node
representing a record and each branch representing a
relationship between records. This structure allows for easy
traversal of data, but can make it more difficult to represent
more complex relationships between records.
https://databasetown.com/7-types-of-dbms-with-examples/
Requirements for a DBMS
The various softwares which handle the data in a database i.e. DBMS (like
Oracle, FoxPro, SQL Server etc.) should meet the following requirements: -
1. Provide data definition facilities.
• Define Data Definition Language (DDL)
• Provide user accessible catalog (Data Dictionary)
2. Provide facilities for storing, retrieving and updating data.
• Define Data Manipulation Language (DML)
3. Support Multiple View of Data
• End User or application should see only the need data and information
required.
4. Provides facilities for specifying Integrity constraints.
• Primary Key Constraints
• Foreign Key Constraints
• More General Constraints
Requirements for a DBMS
The various softwares which handle the data in a database i.e. DBMS (like
Oracle, FoxPro, SQL Server etc.) should meet the following requirements: -
5. Provide facilities for controlling access to data.
• Prevent unauthorized access and update.
6. Allow simultaneous access and update by multiple users.
• Provide concurrency control mechanism.
7. Support Transactions.
• A sequence of operations to be performed as a whole.
• All operations are performed or none.
8. Provide facilities for database recovery.
• Bring database back to consistent state after a failure such as disk
failure, faulty program etc.
9. Provide facilities for database maintenance.
• Maintenance operations: unload, reload, mass Insertion and deletion,
validation etc.
Constraints used to enforce data integrity
In databases, data integrity refers to the accuracy, consistency, and reliability of data
over its lifecycle. To enforce data integrity, several types of constraints are applied, each
designed to ensure that the data adheres to certain rules. Here are the common types of
constraints:
1. Primary Key Constraint
Ensures that each row in a table is uniquely identifiable.
The primary key column(s) must have unique values and cannot contain NULL values.
Example: In a table of Employees, the Employee_ID could be the primary key.
2. Foreign Key Constraint
Enforces a relationship between two tables.
It ensures that the values in one table (child table) correspond to values in another table
(parent table).
It helps maintain referential integrity, ensuring that relationships between records remain
consistent.
Example: In an Orders table, the Customer_ID might be a foreign key that references the
Customer_ID in the Customers table.
3. Unique Constraint
Ensures that all the values in a column or a set of columns are unique across the rows in a
table.
Unlike primary keys, columns with a unique constraint can have NULL values (except when
Constraints used to enforce data integrity
4. Not Null Constraint
Prevents NULL values from being inserted into a column.
Ensures that a column must always have a value.
Example: In a Users table, the Username field might have a NOT NULL
constraint, requiring every user to have a username.
5. Check Constraint
Ensures that the values in a column meet a specified condition.
Allows the enforcement of custom rules for the column.
Example: A Check constraint might ensure that the Age column in a
Customers table only contains values greater than 18.
6. Default Constraint
Automatically assigns a default value to a column if no value is provided
during insertion.
Ensures that a column will always have some value, even if not explicitly
provided.
Example: In an Orders table, the Order_Status column could have a default
value of Pending if no status is provided during an insert.
Constraints used to enforce data integrity

7. Domain Integrity Constraint


Ensures that the values in a column are of a specific type, within a defined
range, or from a predefined list.
This can include data types (e.g., integer, string) or value constraints (e.g.,
using ENUM or a reference to another table for valid values).
Example: The Status column in an Orders table may be restricted to only
accept values such as Pending, Shipped, Delivered.
8. Index Constraint
Although not primarily a constraint for data integrity, unique indexes (like a
unique constraint) can enforce uniqueness and help with performance
optimization when querying data.
Example: Creating a unique index on the email field in a Users table.
DBMS Roles  Job Related tasks
Database Management Systems (DBMS) play a crucial role in modern organizations, and professionals
working with DBMSs perform a variety of tasks to ensure data integrity, security, and accessibility.
Here are some common roles and their corresponding tasks:

1. Database Administrator (DBA):


•Tasks:
• Designing and implementing database structures
• Managing database security and access controls
• Performing regular backups and disaster recovery planning
• Optimizing database performance
• Monitoring database health and troubleshooting issues
• Migrating databases to new platforms or versions

2. Data Analyst:
•Tasks:
• Collecting, cleaning, and preparing data for analysis
• Using SQL and other tools to query and manipulate data
• Identifying patterns, trends, and anomalies in data
• Creating visualizations and reports to communicate findings
DBMS Roles  Job Related tasks
3. Data Engineer:
•Tasks:
• Designing and building data pipelines and architectures
• Integrating data from various sources
• Optimizing data storage and retrieval
• Developing ETL (Extract, Transform, Load) processes
• Implementing data warehousing and data lakes

4. Data Scientist:
•Tasks:
• Applying statistical and machine learning techniques to data
• Building predictive models and algorithms
• Developing data-driven solutions to business problems
• Analyzing complex datasets to extract insights

5. Database Developer:
•Tasks:
• Designing and creating database schemas
• Writing SQL queries and stored procedures
• Developing database applications and interfaces
• Integrating databases with other systems
DBMS Roles  Job Related tasks
6. Data Architect:
•Tasks:
• Designing high-level data architectures and strategies
• Aligning data with business objectives
• Ensuring data quality and consistency
• Overseeing data governance and compliance
7. Data Governance Officer:
•Tasks:
• Developing and implementing data governance policies and standards
• Ensuring data quality and integrity
• Managing data access and security
• Resolving data disputes and conflicts
MySQL
MySQL Workbench is a unified visual tool for database architects, developers, and DBAs.
MySQL Workbench provides data modeling, SQL development, and comprehensive
administration tools for server configuration, user administration, backup, and much more.
MySQL Workbench is available on Windows, Linux and Mac OS X
Creating a Database:
 Open MySQL Workbench and connect to your MySQL server.
 Right-click on the Schemas folder in the navigation pane.
 Select Create Schema.
 Enter a name for your new database (e.g., my_database).
 Click Apply

Creating Tables:
 Right-click on your newly created database in the navigation pane.
 Select Create Table.
 Define the table's columns:
 Enter a column name.
 Choose a data type (e.g., INT, VARCHAR, DATE).
 Specify any constraints (e.g., PRIMARY KEY, NOT NULL, UNIQUE).
 Click Apply.
Inserting Data:
 Right-click on your table in the navigation pane.
 Select Insert Rows.
 Enter values for each column in the table.
 Click Apply.

Querying Data:
 Use SQL queries in the Workbench editor to retrieve, update, or delete
data.
 Common SQL commands include:
 SELECT: Retrieve data from a table.
 INSERT: Insert new data into a table.
 UPDATE: Modify existing data in a table.
 DELETE: Remove data from a table.
Managing Relationships:
 If your database has relationships between tables (e.g., one-to-many,
many-to-many), you can define them in Workbench using the EER
Diagram editor.
 This helps visualize and manage the relationships between tables.

Additional Features:
 MySQL Workbench offers many additional features, including:
 Data modeling and visualization.
 SQL code generation and optimization.
 Database administration tasks.
 Integration with other tools (e.g., version control).
Unit 4 Database Fundamentals: RDBMS, SQL
DBMS: History of Data and its definition - Various formats to recognize
databases - DBMS through MySQL Workbench - DBMS Types and its
features - Requirements of DBMS - Roles, job-related tasks.
RDBMS: Introduction and its uses - popular RDBMS and their uses - Oracle
RDBMS versions and features - SQL Server RDBMS, history and its features
- MySQL RDBMS, history and its features - MySQL Workbench -
Normalization - E.F. Codd.
SQL: Introduction - Connectivity - Reserved words - Data Types – SQL
Commands: DDL - Alter tables - drop and truncate - table constraints -
constraint violation
RDBMS
Relational Database Management Systems (RDBMS)
An RDBMS is a type of database management system (DBMS) that stores
data in a structured format, using tables that are related to each other
through columns. 1 It's designed to handle complex relationships between
data elements efficiently.

Key Components of an RDBMS:


Tables: The fundamental units of data storage. Each table has rows
(records) and columns (fields).
Rows: Represent individual data entries or records.
Columns: Define the attributes or characteristics of the data stored in
each row.
Relationships: Establish connections between tables based on common
fields (columns).
Data Integrity: Ensures the accuracy and consistency of data.
RDBMS

Uses of RDBMS:
RDBMS are widely used in various applications and industries due to their
ability to handle complex data relationships and ensure data integrity.
Some common use cases include
 Enterprise Resource Planning (ERP): Managing business processes, including finance, human
resources, and supply chain.
 Customer Relationship Management (CRM): Tracking customer interactions, sales, and
marketing campaigns.
 Supply Chain Management (SCM): Managing the flow of goods and services from suppliers to
customers.
 Banking and Finance: Handling transactions, customer accounts, and financial reporting.
 E-commerce: Managing product catalogs, orders, and customer information.
 Healthcare: Storing patient records, medical history, and billing information.
 Government: Managing public records, census data, and administrative systems.
 Research and Analytics: Storing and analyzing large datasets for research purposes.
RDBMS and its uses

1. MySQL
•Use cases: Web applications, small-to-medium-sized businesses, and open-source projects.
•Advantages: Free, open-source, easy to use, and has a large community.
•Disadvantages: May not be suitable for extremely large or complex databases.

2. Oracle Database
•Use cases: Enterprise-level applications, banking, finance, and telecommunications.
•Advantages: Robust, scalable, and offers advanced features like data warehousing and data mining.
•Disadvantages: Can be expensive, and the learning curve can be steep.

3. Microsoft SQL Server


•Use cases: Windows-based applications, enterprise-level databases, and data warehousing.
•Advantages: Integrates well with other Microsoft products, offers a rich feature set, and provides strong
performance.
•Disadvantages: Can be expensive, and may not be as flexible as some open-source alternatives.
RDBMS and its uses
4. PostgreSQL
 Use cases: Web applications, scientific and engineering projects, and enterprise databases.
 Advantages: Open-source, highly scalable, and supports a wide range of data types and features.
 Disadvantages: May have a steeper learning curve compared to some other RDBMS.

5. MariaDB
 Use cases: Similar to MySQL, but with a focus on performance and compatibility.
 Advantages: Open-source, fast, and highly compatible with MySQL.
 Disadvantages: May not have as extensive a community as MySQL.

6. SQLite
 Use cases: Small applications, embedded systems, and mobile devices.
 Advantages: Lightweight, self-contained, and easy to use.
 Disadvantages: May not be suitable for large or complex databases.

7. IBM DB2
 Use cases: Enterprise-level applications, mainframe systems, and data warehousing.
 Advantages: Highly scalable, reliable, and offers advanced features like data replication and partitioning.
 Disadvantages: Can be expensive and complex to manage.

8. Sybase ASE
 Use cases: Enterprise-level applications, data warehousing, and online transaction processing (OLTP).
 Advantages: High performance, reliability, and support for large databases.
 Disadvantages: Can be expensive and complex to manage
Oracle RDBMS Versions and Features
Oracle Database, one of the most popular RDBMS, has a long history and
has evolved significantly over time. Each version introduces new features
and enhancements to improve performance, scalability, and functionality.
Here are some key versions and their notable features
Oracle Database 11g (11.2)
 Features:
 Pluggable databases (PDBs) for greater isolation and management
 Automatic Storage Management (ASM) for simplified storage management
 Real Application Clusters (RAC) for high availability and scalability
 Data Guard for disaster recovery and data replication

Oracle Database 12c (12.1, 12.2)


 Features:
 Multitenant architecture for managing multiple databases within a single container database
 In-Memory Column Store for extreme performance on analytical workloads
 JSON support for handling semi-structured data
 Exadata Database Machine for optimized performance on Oracle workloads

Oracle Database 18c (18.1, 18.3)


 Features:
 Autonomous Database for self-driving database capabilities
 Machine Learning integration for building predictive models
 Graph Database support for analyzing interconnected data
 Always Free tier for cloud-based development and testing
Oracle RDBMS Versions and Features
Oracle Database 19c (19.3, 19.8)
•Features:
•Exadata Cloud@Customer for on-premises cloud database experience
•JSON support enhancements for improved performance and functionality
•Oracle Data Safe for data security and compliance
•Oracle Analytics Cloud integration for advanced analytics

Oracle Database 21c


•Features:
•Autonomous JSON Database for optimized JSON data management
•Oracle Spatial and Graph for analyzing geospatial and graph data
•Oracle Blockchain Platform integration for distributed ledger technology
•Oracle Cloud Infrastructure (OCI) integration for cloud-native database capabilities

Oracle Database 23c


•Features:
•Autonomous Data Warehouse Cloud for cloud-based data warehousing
•Oracle Database Exadata Cloud Infrastructure for on-demand cloud database resources
•Oracle Database Edge for running databases on edge devices
•Oracle Database Virtual Machine (VM) for running databases on virtual machines
SQL Server RDBMS

SQL Server is a widely used relational database management system


(RDBMS) developed by Microsoft. It's designed to store, retrieve, and
manage data efficiently and securely. SQL Server is a popular choice for
businesses of all sizes, from small startups to large enterprises, due to its
robust features, scalability, and integration with other Microsoft products.
History:

A Brief History
1989: SQL Server 1.0 was released, initially designed for the OS/2 operating system.
1995: SQL Server 7.0 introduced a major overhaul, including support for clustering and replication.
2005: SQL Server 2005 marked a significant milestone with features like data mining, reporting
services, and integration with the .NET Framework.
2012: SQL Server 2012 introduced columnstore indexes for analytical workloads and AlwaysOn
availability groups for high availability and disaster recovery.
2019: SQL Server 2019 brought new features like big data support, machine learning services, and
enhanced performance
SQL Server RDBMS
Common Use Cases for SQL Server RDBMS:
Enterprise Applications: SQL Server is widely used in enterprise
applications, such as ERP (Enterprise Resource Planning), CRM
(Customer Relationship Management), and SCM (Supply Chain
Management).
Web Applications: SQL Server is a popular choice for powering
web applications, storing user data, product information, and
session data.
Data Warehousing and Business Intelligence: SQL Server can be
used to build data warehouses and support business intelligence
(BI) initiatives.
Reporting and Analytics: SQL Server provides tools for creating
reports, analyzing data, and generating insights.
Machine Learning: SQL Server integrates with machine learning
MySQL RDBMS

MySQL, a popular open-source relational database management system (RDBMS),


was originally developed by a Swedish company called MySQL AB.
It was first released in 1995 and quickly gained popularity due to its simplicity,
performance, and free availability.

In 2005, MySQL AB was acquired by Sun Microsystems, which later became part of Oracle
Corporation. Under Oracle's ownership, MySQL has continued to evolve and expand its
capabilities.

Key Features
MySQL offers a robust set of features that make it a versatile and widely used RDBMS:
Open-source: MySQL is freely available and distributed under the GNU General Public License (GPL),
making it accessible to a wide range of users and developers.
High performance: MySQL is known for its speed and efficiency, making it suitable for various
applications, including web development, e-commerce, and content management systems.
•Scalability: MySQL can handle large datasets and can be scaled to meet the growing demands of your
application.
•Reliability: MySQL is designed to be reliable and fault-tolerant, ensuring data integrity and availability
MySQL RDBMS

Compatibility: MySQL is compatible with the SQL standard, making it easy to migrate
existing databases or write portable SQL code.
Rich feature set: MySQL offers a wide range of features, including:
Storage engines: InnoDB, MyISAM, and others for different storage and performance
requirements.
Indexing: B-tree, full-text, and spatial indexes for efficient data retrieval.
Replication: Master-slave replication for high availability and data distribution.
Clustering: MySQL Cluster for high availability and scalability.
Security: User authentication, role-based access control, and encryption.
Transactions: ACID (Atomicity, Consistency, Isolation, Durability) support for reliable
data management
MySQL RDBMS

MySQL is used in a wide range of applications, including:


Web development: MySQL is a popular choice for powering dynamic websites and
web applications.
E-commerce: MySQL is used to store product information, customer data, and order
details.
Content management systems: MySQL is used to manage content, users, and
permissions in content management systems like WordPress and Drupal.
Gaming: MySQL is used to store game data, player profiles, and leaderboards.
Analytics: MySQL can be used to store and analyze large datasets for business
intelligence and reporting
MySQL Workbench
MySQL Workbench is a graphical user interface (GUI) tool designed to
simplify the administration, development, and modeling of MySQL
databases. It provides a user-friendly environment for tasks such as
creating databases, tables, and relationships; designing ER diagrams;
writing SQL queries; and managing users and privileges.
Key Features:
Visual Database Design: Create and edit ER diagrams to model database
structures and relationships visually.
SQL Editor: Write and execute SQL queries, scripts, and procedures.
Data Import/Export: Import and export data from and to various formats
(CSV, XML, etc.).
Database Administration: Manage users, roles, privileges, and database
configuration settings.
Performance Optimization: Analyze query performance and identify
bottlenecks.
Data Migration: Migrate data between MySQL databases or from other
database systems.
Normalization

Normalization in Database Design


Normalization is a database design technique that organizes data into
tables to minimize redundancy and improve data integrity. It involves
breaking down a large table into smaller tables that are related to each
other through foreign keys

Why is Normalization Important?


1.Reduces Redundancy: By eliminating duplicate data, normalization
saves storage space and prevents inconsistencies.
2.Enhances Data Integrity: Normalization ensures that data is accurate
and consistent, reducing the risk of errors and inconsistencies.
3.Improves Performance: Normalized databases can often be queried
more efficiently, leading to better performance.
4.Facilitates Data Maintenance: Normalization makes it easier to modify
and update data without affecting other parts of the database
Normalization Forms
There are several normalization forms, each representing a different level
of data organization:
1.First Normal Form (1NF):
1.Each column in a table should contain atomic values (i.e., values that
cannot be further divided).
2.No repeating groups within a row.
2.Second Normal Form (2NF):
1.The table must be in 1NF.
2.All non-key attributes must be fully dependent on the primary key.
3.Third Normal Form (3NF):
1.The table must be in 2NF.
2.No non-key attribute should be transitively dependent on the primary
key.
4. Boyce-Codd Normal Form (BCNF):
•The table must be in 3NF.
•Every determinant must be a superkey
Example:
Consider a table called "OrderItems" that stores information about orders
and their items:

Order ID Item ID Quantity Price Customer Name Customer Address


1 101 2 20 Sendil 1234 Avadi
1 102 1 50 Sendil 1234 Avadi
2 103 3 10 Ganesan 5689 Morai

This table is not normalized because there is redundancy in the


"CustomerName" and "CustomerAddress" columns for each order.
Example:
Consider a table called "OrderItems" that stores information about orders
and their items:
We can normalize it into two tables:
Orders:
Order ID Customer ID
1 1
2 2

Customers:
Customer
Customer Name Customer Address
ID
1 Sendil 1234 Avadi
2 Sendil 1234 Avadi
2 Ganesan 5689 Morai

Now, the data is organized more efficiently and the redundancy is eliminated.
Choosing the right Normalization Form

The appropriate normalization form depends on the specific requirements


of your application and the trade-offs between data integrity and
performance. Over-normalization can sometimes lead to performance
issues, while under-normalization can compromise data integrity.
Given Table:

STUD STUD STUD STUD STUD


ID Name Phone State Country

913245678
5,
1 Sendil Tamilnadu India
884567890
1
763221548
2 Sendil Tamilnadu India
9
Converted in to First Normal Form (1NF):
685945613
3 Alavudeen Kerela India
1
STUD STUD STUD STUD STUD
ID Name Phone State Country

913245678
1 Sendil Tamilnadu India
5
884567890
2 Sendil Tamilnadu India
1
763221548
3 Sendil Tamilnadu India
9
685945613
Given Table:

STUD ID Course Code Course Name

Computer
1 102CS0012
Networks
Software
1 102GE10234
Engineering
2 102CS4578 Operating System
Converted in to 3Second Normal Form (2NF): Software
102GE10234
2NF tries to reduce the redundant data getting storedEngineering
in memory
STUD Course Course Code Course Name
ID Code Computer
102CS0012
Networks
1 102CS0012
Software
102GE10234
1 102GE10234 Engineering
2 102CS4578 Operating
102CS4578
System
3 102GE10234
Given Table: STUD STUD PINCOD STU STATE
STUD Country
ID Name E Name

1 Ram 600055 Tamilnadu India


2 Sendil 501506 Telengana India
Maharashtr
3 Alavudeen 400001 India
a
4 Kalai 670001 Kerela India
Converted in to Third Normal Form (3NF):
In this table, the Candidate Key is Stud ID which is a prime attribute, and the rest of the
attributes are Non-Prime. Thus, there is no partial dependency. So, it is in 2NF.
But, STU_ID->PINCODE and PINCODE->STU_STATE are the two functional dependencies that
exist. Since pincode is a non-prime attribute, STU_STATE indirectly depends on STU_ID.
Therefore, STU_ID->STU_STATE also exists which is a Transitive Functional Dependency.
Transitive Functional STUD STUD PINCOD PINCOD STU STATE
STUD Country
Dependency occurs when ID Name E E Name
a non-prime attribute is
dependent on another 1 Ram 600055 600055 Tamilnadu India
non-prime attribute. 2 Sendil 501506 501506 Telengana India
3 Alavudeen 400001 Maharashtr
400001 India
4 Kalai 670001 a
670001 Kerela India
Boyce-Codd Normal Form (BCNF)
A table or a relation exists in the BCNF if: It exists in 3NF. And For every Functional Dependency
A->B in the table, A is a Super Key.
In simple words, if there exists a Functional Dependency X->Y in the table such that Y is a Prime
Attribute and X is a non-prime attribute, then the table is not in BCNF.
‘Customer Service’ which contains the data about the Product, Customer, and Seller.
Therefore, the following conclusions can be drawn
For the given table:
from the table:
Candidate Keys = {Product ID, Customer ID}
Since all the values in the columns are atomic, the
Prime Attributes: Product ID and Customer ID
Table is in 1NF.
Non-Prime Attributes: Seller Name
The dependency Customer ID ->Seller Name is not
possible because One Customer may purchase from
Produc Custom Seller more than one seller. Thus, there is no Partial
t ID er ID Name Dependency i.e. seller name(non-prime attribute)
1 12 XYZ does not depend on Customer ID(a subset of
Candidate Key). Thus, the Table is in 2NF.
1 14 ABC Functional Dependencies present in the table are:
2 34 PQR Data · Product ID, Customer ID>Seller Name
Redundanc · Seller Name->Customer ID
3 11 ABB y For Transitive Dependency, a non-prime attribute
4 11 ABB should determine another non-prime attribute. But
5 11 ABB here, Seller Name is a non-prime attribute but
Customer ID is a Prime Attribute. Therefore, there is
no Transitive Dependency. Thus, Table exists in 3NF.
Boyce-Codd Normal Form (BCNF)
A table or a relation exists in the BCNF if: It exists in 3NF. And For every Functional Dependency
A->B in the table, A is a Super Key.
In simple words, if there exists a Functional Dependency X->Y in the table such that Y is a Prime
Attribute and X is a non-prime attribute, then the table is not in BCNF.
‘Customer Service’ which contains the data about the Product, Customer, and Seller.
For a table to exist in BCNF, in Every Functional Dependency,
LHS should be a Super Key. But in Seller Name->Customer ID,
Seller Name is not a Key. Therefore, the table does not exist
in BCNF.
Now, let’s convert the table into BCNF Form of Normalization
in DBMS. We break the table into two tables as follows:
Produc Custom Seller Produc Seller Seller Custome
t ID er ID Name t ID Name Name r ID
1 12 XYZ 1 XYZ XYZ 12
1 14 ABC 1 ABC ABC 14
2 34 PQR Data 2 PQR PQR 34
Redundanc
3 11 ABB y 3 ABB ABB 11
4 11 ABB 4 ABB
5 11 ABB 5 ABB
CODD’s Rules:
13 rules for defining the requirements for a DBMS to be considered to be
Relational which was proposed by English Computer Scientist Edgar F.Codd.

If a DBMS is considered to be a RDBMS, then it must satisfy all the13 rules


(Rules are numbered from 0 to 12).
Rule Name of the Rule Rule Name of the Rule
Possible for higher level Insert,
0 The Foundation Rule 7
Update and Delete
1 The Information Rule 8 Physical Data Independence
2 The Guaranteed Access Rule 9 Logical Data Independence
Systematic Treatment of Null
3 10 Integrity Independence
Values
4 Dynamic Online Catalog 11 Distribution Independence
The Comprehensive Data
5 12 The Non-subversion Rule
Sublanguage Rule
6 The View Updating Rule
CODD’s Rules:

Rule 0: The Foundation Rule


The database must be in relational form. So that the system can handle the database through its relational capabilities.
Rule 1: Information Rule
A database contains various information, and this information must be stored in each cell of a table in the form of rows and
columns.
Rule 2: Guaranteed Access Rule
Every single or precise data (atomic value) may be accessed logically from a relational database using the combination of
primary key value, table name, and column name.
Rule 3: Systematic Treatment of Null Values
This rule defines the systematic treatment of Null values in database records. The null value has various meanings in the
database, like missing the data, no value in a cell, inappropriate information, unknown data and the primary key should not be
null.
Rule 4: Active/Dynamic Online Catalog based on the relational model
It represents the entire logical structure of the descriptive database that must be stored online and is known as a database
dictionary. It authorizes users to access the database and implement a similar query language to access the database.
Rule 5: Comprehensive Data Sub Language Rule
The relational database supports various languages, and if we want to access the database, the language must be the explicit,
linear or well-defined syntax, character strings and supports the comprehensive: data definition, view definition, data
manipulation, integrity constraints, and limit transaction management operations
Rule 6: View Updating Rule
All views table can be theoretically updated and must be practically updated by the database systems
CODD’s Rules:
Rule 7: Relational Level Operation (High-Level Insert, Update and delete) Rule
A database system should follow high-level relational operations such as insert, update, and delete in each level or a single row. It
also supports union, intersection and minus operation in the database system.
Rule 8: Physical Data Independence Rule
All stored data in a database or an application must be physically independent to access the database. Each data should not depend on
other data or an application. If data is updated or the physical structure of the database is changed, it will not show any effect on
external applications that are accessing the data from the database.
Rule 9: Logical Data Independence Rule
It is similar to physical data independence. It means, if any changes occurred to the logical level (table structures), it should not affect
the user's view (application). For example, suppose a table either split into two tables, or two table joins to create a single table, these
changes should not be impacted on the user view application.
Rule 10: Integrity Independence Rule
A database must maintain integrity independence when inserting data into table's cells using the SQL query language. All entered
values should not be changed or rely on any external factor or application to maintain integrity. It is also helpful in making the
database-independent for each front-end application.
Rule 11: Distribution Independence Rule
The distribution independence rule represents a database that must work properly, even if it is stored in different locations and used
by different end-users.
Suppose a user accesses the database through an application; in that case, they should not be aware that another user uses particular
data, and the data they always get is only located on one site. The end users can access the database, and these access data should be
independent for every user to perform the SQL queries.
Rule 12: Non Subversion Rule
The non-submersion rule defines RDBMS as a SQL language to store and manipulate the data in the database. If a system has a low-
level or separate language other than SQL to access the database system, it should not subvert or bypass integrity to transform data.
Unit 4 Database Fundamentals: RDBMS, SQL
DBMS: History of Data and its definition - Various formats to recognize
databases - DBMS through MySQL Workbench - DBMS Types and its
features - Requirements of DBMS - Roles, job-related tasks.
RDBMS: Introduction and its uses - popular RDBMS and their uses - Oracle
RDBMS versions and features - SQL Server RDBMS, history and its features
- MySQL RDBMS, history and its features - MySQL Workbench -
Normalization - E.F. Codd.
SQL: Introduction - Connectivity - Reserved words - Data Types – SQL
Commands: DDL - Alter tables - drop and truncate - table constraints -
constraint violation
SQL:
SQL was invented in the 1970s based on the relational data model. It was
initially known as the structured English query language (SEQUEL).
Structured query language (SQL) is a programming language for storing
and processing information in a relational database.
A relational database stores information in tabular form, with rows and
columns representing different data attributes and the various
relationships between the data values.
Structured query language (SQL) is a popular query language that is
frequently used in all types of applications.
Data analysts and developers learn and use SQL because it integrates well
with different programming languages.
For example, they can embed SQL queries with the Java programming
language to build high-performing data processing applications with major
SQL database systems such as Oracle or MS SQL Server.
SQL is also fairly easy to learn as it uses common English keywords in its
SQL:
Java Database Connectivity is a standard API or we can say an application interface present
between the Java programming language and the various databases like Oracle, SQL,
PostgreSQL, MongoDB, etc. It basically connects the front end(for interacting with the users)
with the backend for storing data entered by the users in the table details. JDBC or Java
Database Connection creates a database by following the following steps:
 Import the database
 Load and register drivers
 Create a connection
 Create a statement
 Execute the query
 Process the results
 Close the connection

You might also like