RDBMS
RDBMS
UNIT – 4
RELATIONAL DATABASE
MANAGEMENT SYSTEM
INTRODUCTION
A database is a collection of interrelated data. A database
comprises the information about a particular organization or an
enterprise. Database system are designed to manage large bodies of
information.
Management of data involves both defining structures for storage
of information and providing mechanism for the manipulation of
information. In addition, the database system must ensure the safety of
the information stored.
Database Management System (DBMS) is a software that enables
users to create, store, maintain and retrieve data from the database.
Database management system was first introduced in the year
1960 by Charles W. Bachman.
The popular DBMSs are MYSQL, PostgreSQL, Microsoft Access,
Objectives of Database
Oracle, Microsoft :
SQL Server, DB2 and Sybase.
Several users can share the same data such that each user can
access the same data accordingly to his/her requirement. The database
ensured that not only the data is shared among users but also the data
5. Databases Enforce Standards :
The standards laid by an organization are important for its
efficient working. The standard centralized database is very helpful
during migration or interchanging of data.
6. Databases Ensure Data Security :
Databases can enforce access control that governs what data will
be visible to different class of user. DBMS provides a security and
authorization subsystem which the database administrator us to create
RDBMS
accounts and to specify account restriction.
NOTE : The primary key column and the foreign key column must have
the same data type and size.
NTRODUCTION TO MY SQL
MySQL is a most widely used relational database management
system. It is free and open source application which w.as founded and
developed in Sweden by David Axmark, Allan Larsson and Michael
Widenius, who had worked together since the 1980s.
Characteristics of MySQL :
Data type indicates the type of data that you are storing in a
given table column. The data type of a column defines what value the
column can hold like text, numeric, date, time etc.
DAT DATA EXAMP
DESCRIBTION
A TYPE LE
A fixed-length string from 1 to 255
characters in length right-padded with
CHAR spaces to the specified length when 'Maths'
TEXT
(Size) stored. Values must be enclosed in single "Text"
quotes or double quotes
DATA EXAMPL
DATA DESCRIBTION
TYPE E
A variable-length string from 1 to 255
'Compute
VARCHA characters in length; i.e. VARCHAR(25).
TEXT r' "good
R (Size) Values must be enclosed in single
morning"
quotes or double quotes
It can represent number with or without
the fractional part. The maximum
DECIMA number of digits may be specified in the
Numer 17.32
L size parameter. The maximum number
ic 345
(size, d) of digits to the right of the decimal point
is specified in the d parameter. It takes 8
bytes for storage.
Numer INT Or It is used for storing integer values. You
ic INTEGE can specify a width upto 11. It takes 4 76
R bytes for storage.
It represents the date including day,
month and year. The default format is '2009-07-
Date DATE
“YYYY-MM-DD”. It takes 3 bytes for 02
storage.
It represents time. Format: HH:MM:SS '-
USING MY SQL
MySQL is case sensitive.
The SQL statement always ends with ( ; ).
Do not use ; in a multiline SQL statement, press only enter key.
Creating a Database :
CREATE command is used to create a database in MySQL.
Creating a Table:
<ColumnName2><DataType2>………….
<ColumnNameN><DataTypeN>;
Constrain Purpose
ts
Primary The column which can uniquely identify each row in a
Key table. Primary key field cannot contain NULL and
Duplicate values.
Not Null It ensures that a column cannot have NULL values, where
NULL means missing/Unknown/ Not applicable value.
Foreign Key The column in the child table which refers to value of an
field defined as primary key in another table.
Unique It ensure that all values in a column are distinct, but Null
value is acceptable.
Default A default value specified for the column if no value is
provided.
Example :
To see a list of tables present in the current database, we can use SHOW
TABLE command.
If no condition is
specified then all the records
of the table are removed i.e.
the table becomes empty.