Sei sulla pagina 1di 5

What is Data?

In simple words data can be facts related to any object in consideration.


For example your name, age, height, weight, etc are some data related to you.
A picture , image , file , pdf etc can also be considered data.

What is a database?
Database Definition database is a systematic collection of data. Databases support storage and
manipulation of data. Databases make data management easy.

What is a Database Management System


(DBMS)?
Database Management System (DBMS) is a collection of programs which enables its users to access
database, manipulate data, reporting / representation of data .
It also helps to control access to the database

Types of DBMS

There are 4 major types of DBMS. Let's look into them in detail.

Hierarchical - this type of DBMS employs the "parent-child" relationship of storing data.
This type of DBMS is rarely used nowadays. Its structure is like a tree with nodes representing
records and branches representing fields. The windows registry used in Windows XP is an
example of a hierarchical database. Configuration settings are stored as tree structures with nodes.

Network DBMS - this type of DBMS supports many-to many relations. This usually results
in complex database structures. RDM Server is an example of a database management system that
implements the network model.

Relational DBMS - this type of DBMS defines database relationships in form of tables, also
known as relations. Unlike network DBMS, RDBMS does not support many to many
relationships.Relational DBMS usually have pre-defined data types that they can support. This is

the most popular DBMS type in the market. Examples of relational database management systems
include MySQL, Oracle, and Microsoft SQL Server database.

Object Oriented Relation DBMS - this type supports storage of new data types. The data to
be stored is in form of objects. The objects to be stored in the database have attributes (i.e. gender,
ager) and methods that define what to do with the data. Postgre SQL is an example of an object
oriented relational DBMS.

Introduction to SQL
Structure Query Language(SQL) is a programming language used for storing and managing data in
RDBMS. SQL was the first commercial language introduced for E.F Codd's Relational model. Today
almost all RDBMS (MySql, Oracle, Infomix, Sybase, MS Access) uses SQL as the standard database
language. SQL is used to perform all type of data operations in RDBMS.

SQL Command
SQL defines following data languages to manipulate data of RDBMS.

DDL : Data Definition Language


All DDL commands are auto-committed. That means it saves all the changes permanently in the
database.

Command

Description

create

to create new table or database

alter

for alteration

truncate

delete data from table

drop

to drop a table

rename

to rename a table

DML : Data Manipulation Language


DML commands are not auto-committed. It means changes are not permanent to database, they can be
rolled back.

Command

Description

insert

to insert a new row

update

to update existing row

delete

to delete a row

merge

merging two rows or two tables

TCL : Transaction Control Language


These commands are to keep a check on other commands and their affect on the database. These
commands can annul changes made by other commands by rolling back to original state. It can also
make changes permanent.

Command

Description

commit

to permanently save

rollback

to undo change

savepoint

to save temporarily

DCL : Data Control Language


Data control language provides command to grant and take back authority.

Command

Description

grant

grant permission of right

revoke

take back permission.

DQL : Data Query Language


Command

Description

select

retrieve records from one or more table

Explanation of commands with syntax

create command
create is a DDL command used to create a table or a database.

Creating a Database
To create a database in RDBMS, create command is used.
Create database database-name;

Example for Creating Database


Create database test;
The above command will create a database named Test.

Creating a Table
create command is also used to create a table. We can specify names and datatypes of various
columns along.Following is the Syntax,
createtabletablename
(column1datatypesize,
column2datatypesize,
column3datatypesize);

Example:
createtableemployee
(firstvarchar(15),
lastvarchar(20),
agenumber(3),
addressvarchar(30),

cityvarchar(20),
statevarchar(20));

Potrebbero piacerti anche