DATABASE MANAGEMENT
SYLLABUS:
Introduction to database concepts and its need.
Relational data model: Relation, attribute, tuple, domain, degree, cardinality, keys (candidate key, primary
key, alternate key, foreign key).
Structured Query Language: Introduction, Data Definition Language and Data Manipulation Language,
data type (char(n), varchar(n), int, float, date), constraints (not null, unique, primary key), create database,
use database, show databases, drop database, show tables, create table, describe table, alter table (add and
remove an attribute, add and remove primary key), drop table, insert, delete, select, operators
(mathematical, relational and logical), aliasing, distinct clause, where clause, in, between, order by,
meaning of null, is null, is not null, like, update command, delete command, aggregate functions (max, min,
avg, sum, count), group by, having clause, joins: cartesian product on two tables, equi-join and natural join.
Interface of python with an SQL database: Connecting SQL with Python, performing insert, update, delete
queries using cursor, display data by using connect(), cursor(), execute(), commit(), fetchone(), fetchall(),
rowcount, creating database connectivity applications, use of %s format specifier or format() to perform
queries.
INTRODUCTION
A database is a collection of interrelated data stored together to serve multiple applications.
A DBMS (Data Base Management System) refers to a software that is responsible for storing,
maintaining and utilizing databases.
A database along with a DBMS is referred to as a database system.
PURPOSE OF DBMS
In a typical file processing system, permanent records are stored in various files. But this scheme has
major limitations and disadvantages such as data redundancy (duplication of data), data inconsistency
(mismatched multiple copies of same data), unsharable data, unstandardized data, insecure data,
incorrect data, etc.
A DBMS provides a centralized control of the data, thereby minimizing these problems in the database.
RELATIONAL DATA MODEL
In relational data model, the data is organized into tables (i.e., rows and columns) or relations. A row in
a table represents a relationship among a set of values.
Rows of relations are generally referred to as tuples and the columns are usually referred to as attributes.
A relation has the following properties:
1. In any given column of a table, all items are of the same kind whereas items in different columns
may not be of the same kind.
2. For a row, each column must have an atomic (indivisible) value and also for a row, a column cannot
have more than one value.
3. All rows of a relation are distinct, i.e., a relation does not contain two rows which are identical in
every column.
4. There is no order maintained for rows inside a relation.
5. The columns of a relation are assigned distinct names and the ordering of these columns is
immaterial.