A DBMS is a software-based system that provides a management interface, which helps users control databases and data sources.
Example:
A building name, A flat no in the building, A road name,
An area name, A state name

A Database Management System (DBMS) is software designed to store, retrieve, define and manage data in a database.
- The amount of data redundancy in stored data can be reduced.
- Stored data can be shared by a single or multiple users.
- Security of data can be simply implemented
- Standards can be set and followed
All modern database management systems like SQL, MS SQL Server, IBM DB2, ORACLE, My-SQL and Microsoft Access are based on RDBMS.
It is called Relational Data Base Management System (RDBMS) because it is based on relational model introduced by E.F. Codd.
SQL is a language that provides an interface to relation database systems.
There are main components of SQL are as follows:
- DDL(Data Definition Language)
- DML(Data Manipulation Language)
- DCL(Data Control Language)
- DQL(Data Query Language)
It is a set of SQL commands used to create,modify and delete database structures but not data.
Example:
Create, Alter, Drop, Truncate & Rename
It is the area of SQL that allows changing data within the database.
Example:
Insert, Update, Delete
It is the component of SQL statement that control access to
data and to database.
Example:
Commit,Savepoint,Rollback,Grant
This command is the heart of SQL .
Example:
Select Retrieve data from the a database
.png)
[DDL & DML
STATEMNTS]
|
Overview
|
|
DDL statements are used to create database, schema,
constraints, users, tables etc.DML is Data Manipulation Language and is used
to manipulate data. Examples of DML are insert, update and delete statements.
|
|
DDL
& DML
|
SYNTAX
|
EXAMPLE
|
|
CREATE
DATABASE
USE DATABASE
|
CREATE DATABASE databasename;
Use DBName
|
CREATE DATABASE testDB;
Use testDB
|
CREATE TABLE
|
CREATE TABLE table_name (
column1 datatype,
column2 datatype,
column3 datatype,
....
)
|
CREATE TABLE Persons
(
PersonID int,
LastName varchar(255),
FirstName varchar(255),
Address varchar(255),
City varchar(255)
)
|
INSERT
|
INSERT INTO table_name (column1, column2, column3,
...)
VALUES (value1, value2, value3, ...)
INSERT INTO table_name
VALUES (value1, value2, value3, ...)
|
INSERT INTO Customers (CustomerName,
ContactName, Address, City, PostalCode, Country)
VALUES ('Cardinal', 'Tom B. Erichsen', 'Skagen
21', 'Stavanger', '4006', 'Norway')
INSERT INTO Customers (CustomerName, City,
Country)
VALUES ('Cardinal', 'Stavanger', 'Norway')
|
UPDATE
|
UPDATE table_name
SET column1 = value1, column2 = value2,
...
WHERE condition;
|
UPDATE Customers
SET ContactName = 'Alfred Schmidt', City= 'Frankfurt'
WHERE CustomerID = 1
UPDATE Customers
SET ContactName='Juan'
WHERE Country='Mexico'
|
DELETE
|
DELETE FROM table_name WHERE condition
DELETE FROM table_name
|
DELETE FROM Customers WHERE CustomerName='Alfreds
Futterkiste'
DELETE FROM Customers
|
SELECT
|
SELECT column1, column2,
...
FROM table_name
SELECT * FROM table_name
|
SELECT CustomerName,
City FROM Customers
SELECT * FROM Customers
|
The content provided is very useful to learn SQL basics.
ReplyDelete