You are on page 1of 3

Relational Databases

1. Database:- A database is a collection of interrelated data stored together to serve multiple applications.
2. DBMS:- 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.
3. Data Redundancy:- Duplication of data is knows as data redundancy.
4. Examples of common relational database management system:- Oracle, Microsoft SQL server, MYSQL,
SQLite etc. Common database management tools for mobile devices include SQL Anywhere, SQL server
compact etc.
5. RDBMS(Relational Database Management System):- A relational database refers to a database that stores
data in a structured format, using rows and columns. This makes it easy to locate and access specific values
within the database. It is "relational" because the values within each table are related to each other. Tables
may also be related to other tables. The relational structure makes it possible to run queries across multiple
tables at once. The relational model was given by E.F. Codd of the IBM and acknowledged as a very
important concept in DBMS technology.
Relation A relation is a table. Data arranged in rows and columns.
Tuple The rows of a relation are known as tuples.
Attributes The columns of a relation are known as attributes. Also called fields.
Data values A single information.
Degree The number of attributes (columns).
Cardinality The number of tuples (rows).
Domain A domain is a pool of values from which the actual values appearing in a given column
are drawn. (Also called A set of permitted values used in a column)
View A view is a kind of table whose contents are taken from other tables depending upon a
condition. Views do not contain data of their own.
Data Dictionary A file containing metadata. (Also called Data about data)
6. Keys- It is used to decide how rows in a relation are different logically. Keys types:
 Primary Key:- A Primary key is a set of one or more attributes that can uniquely identify tuples within the
relation. for example:- Rollno of a student table.
 Candidate Key:- All attributes combination inside a relation that can serve as primary key are candidate keys
as they are candidates for the primary key position. for example:- Rollno and GRNo are candidate key.
 Alternate Key:- A Candidate Key that is not the primary key is called an Alternate key. If we select Rollno of a
student table as a primary key than remaining key (GRNo) will be a alternate key of a student table.
 Foreign Key:- A non-key attribute whose values are derived from the primary key of some other table, is
known as Foreign key in its current table. for example:- Rollno of a marks table.

1
7. Referential Integrity:- A referential integrity is a system of rules that a DBMS uses to ensure that relationships
between records in related tables are valid, and that users don't accidentally delete or change related data.
when referential integrity is enforced, you must observe the following rules:-
 The matching field from the primary table is a primary key or has a unique index. The related fields have
the same data types. Both tables belong to the same database.
 you can't enter a value in the foreign key field of the related table that doesn't exist in the primary key
of the primary table.
 you can't delete a record from a primary table if matching records exist in a related table.
 you can't change a primary key valued in the primary table, if that record has related records.
8. SQL (Structured Query Language) commands can be divided into following categories:-
 DDL (Data Definition Language):- This command allow to perform tasks related to data definition. we
can create, edit and delete table structure. for example:- Create, Alter, Drop Schema Objects and
Grant and revoke privileges and roles.
 DML (Data Manipulation Language):- This command allow users to access or manipulate data as
organized by the appropriate data model. for example:- select, insert, update and delete records of a
table. DMLs are basically of two types:-
o Procedural DMLs:- It require a user to specify what data is needed and how to get it. In this we
create a SQL program.
o Non-Procedural DMLs:- It require a user to specify what data is needed without specifying how
to get it. In this it doesn't require to create a SQL program.
 TCL (Transaction Control Language):- It is used to manage transactions. (A transaction is one complete
unit of work). Some example of TCL commands are:- COMMIT, ROLLBACK, SAVEPOINT, SET
TRANSACTION.
COMMIT:- It makes all the changes made by statements issued, permanent.
ROLLBACK:- It undoes all changes since the beginning of a transaction or since a savepoint.
9. MySQL:- MySQl is a free, open source Relational Database Management System (RDBMS) that uses
structured Query language (SQL). In a MySQL database, information is stored in Tables. A single MySQL
database can contain many tables at once and store thousands of individual records.
 MySQL key features are:- Run very fast, Ease of use, free of cost, Portable, provides security,
connectivity etc.
 MySQL server instance:- It is created from background processes and applications. It stays in
memory and listens for client request coming in over the network and accesses database contents
according to those requests and provides that to the clients.
 MySQL Clients:- It is programs that connect to the MySQL server and issue queries in a pre-specified
format.
 MySQL Command line programs:- mysqldump and mysqladmin
 MySQL GUI programs:- MySQL Adminstrator and MySQL QueryBrowser

2
RDBMS Example:-

School ->database
Student->table name Marks->table name
Rollno(PK) Name DOB Fees Rollno(FK) Subject Marks
(number) (text) (Date/time) (number) (number) (text) (number)
101 Raj 21/12/2003 4000 101 Hindi 80
102 Himmat 01/10/2002 5000 101 English 75
103 Akash 05/08/2001 3000 101 Maths 95
102 Hindi 79
102 English 80
102 Maths 90
Here:
School Database Name
Student Relation(table) Name
Marks Relation(table) Name
Student table Attributes (fields) names Rollno, Name, DOB, Fees
Marks table Attributes (fields) names Rollno, Subject, Marks
Degree :- total no. of columns Student table degree: 4, Marks table degree: 3
Cardinality:-total no. of rows Student table cardinality: 3, Marks table cardinality: 6
Domain- A set of permitted value. student table rollno range (101 to 200)
Data types: Number, text, date/time
NULL value: Any unknown or missing information represent in table in the
form of null value.
Primary key: It is used to identify a record uniquely, in a table. It never accepts
duplicate data in a column. It is a key field of a table. It never holds
null value.
For example: primary key of student table is Rollno
Foreign key:- It is used in another table. It is depend on primary key. It may
have duplicate data.
For example: foreign key of marks table is Rollno

Records(tuples) of student table 101 Raj 21/12/2003 4000


102 Himmat 01/10/2002 5000
103 Akash 05/08/2001 3000

Records(tuples) of marks table 101 Hindi 80


101 English 75
101 Maths 95
102 Hindi 79
102 English 80
102 Maths 90

You might also like