DATA MANIPULATION
LANGUAGE
Dr.SNS RAJALAKSHMI COLLEGE OF ARTS AND SCIENCE
COIMBATORE-49
(AUTONOMOUS)
Accredited by NAAC (Cycle-III) with ‘A+’ Grade
DEPARTMENT OF COMMERCE WITH FINANCE
CONTENTS
Introduction
SQL Commands
Data manipulation Language
Conclusion
INTRODUCTION
• A Relational database management system (RDBMS) is a database
management system (DBMS) that is based on the relational model as
introduced by E. F. Codd.
• RDBMS is the basis for SQL, and for all modern database systems like
MS SQL Server, IBM DB2, Oracle, MySQL, and Microsoft Accss.
• MySQL is an open source SQL database, which is developed by a
Swedish company – MySQL AB.
• MySQL comes with a very fast, multi-threaded, multi-user and robust
SQL database server.
SQL COMMANDS
CREATE
ALTER
DROP
TRUNCATE
INSERT
UPDATE
DELETE
MERGE
GRANT
REVOKE
DDL DML DCL
Second Page
DATA MANIPULATION LANGUAGE
DML represents a collection of programming languages explicitly
used to make changes in the database.
 CRUD operations to create, read, update, and delete data
 Using the INSERT, SELECT, UPDATE and Delete commands.
In the beginning, DML commands were par of computer
programs only, but with the popularity of SQL, they have now
become a part of database management.
• DML have two primary classifications: Procedural and Non-
procedural programming (declarative programming).
SELECT: Command to fetch data or values from the database
INSERT: Command to add new or fresh value to the database
UPDATE: Command to change or update the present/existing
data to a newer value inside the database
DELETE: Command to remove or delete the values or data
information from the database’s current table
MERGE: Command to merge two or more data tables inside a
database.
SELECT COMMAND
• It is used to retrieve data from the database.
• This command allows database users to retrieve the specific
information they desire from an operational database.
• It returns a result set of records from one or more tables.
• For Example,
SELECT * FROM employee
where salary >=10,000;
Syntax:
SELECT * FROM <table_name>;
INSERT COMMAND
• It is used for inserting a data into a table.
• Using this command, you can add one or more records to any
single table in a database.
• It is also used to add records to an existing code.
For Examples,
INSERT INTO CUSTOMERS (ID,NAME,AGE,CITY,COMPENSATION)VALUES (1, Kritesh, 45, ‘Delhi’, 2500.00
); INSERT INTO CUSTOMERS (ID,NAME,AGE,CITY,COMPENSATION)VALUES (2, Mehta, 35,Kochi,
1500.00 );
All the above records will fetch the following result on checking the CUSTOMERS table as following:
| ID | NAME | AGE | ADDRESS | SALARY |
| 1 | Kritesh | 45 | Delhi | 2500.00 ||
2 | Mehta | 35 | Kochi | 1500.00 ||
Syntax:
INSERT INTO <table_name> (`column_name1` <datatype>, `column_name2`
<datatype>, . . . , `column_name_n` <database>) VALUES (`value1`,
`value2`, . . . , `value n`);
UPDATE COMMAND
• It is used to modify the records present in existing table.
• This command updates existing data within a table.
• It changes the data of one or more records in a table.
UPDATE CUSTOMERSSET ADDRESS = ‘Indore’WHERE ID = 2;On
checking, the customer records will fetch the following result:
| ID | NAME | AGE | ADDRESS | SALARY |
| 1 | Kritesh | 45 | Delhi | 2500.00 ||
2 | Mehta | 35 | Indore | 1500.00 ||
UPDATE CUSTOMERSSET ADDRESS = ‘Indore’, SALARY = 3000.00;
ID | NAME | AGE | ADDRESS | SALARY |
| 1 | Kritesh | 45 | Delhi | 2500.00 ||
2 | Mehta | 35 | Indore | 3000.00 ||
Syntax:
UPDATE <table_name>
SET <column_name = value>
WHERE condition;
DELETE COMMAND
• DELETE command is used to delete some or all records from
the existing table.
• It deletes all the records from a table.
SQL>DELETE FROM employee WHERE emp_id = '1';
SQL> DELETE FROM CUSTOMERS;
This will delete all records of the customers from a specific database,
respectively.
Syntax:
DELETE FROM
<table_name> WHERE
<condition>;
data manipulation language

data manipulation language

  • 1.
    DATA MANIPULATION LANGUAGE Dr.SNS RAJALAKSHMICOLLEGE OF ARTS AND SCIENCE COIMBATORE-49 (AUTONOMOUS) Accredited by NAAC (Cycle-III) with ‘A+’ Grade DEPARTMENT OF COMMERCE WITH FINANCE
  • 2.
  • 3.
    INTRODUCTION • A Relationaldatabase management system (RDBMS) is a database management system (DBMS) that is based on the relational model as introduced by E. F. Codd. • RDBMS is the basis for SQL, and for all modern database systems like MS SQL Server, IBM DB2, Oracle, MySQL, and Microsoft Accss. • MySQL is an open source SQL database, which is developed by a Swedish company – MySQL AB. • MySQL comes with a very fast, multi-threaded, multi-user and robust SQL database server.
  • 5.
  • 6.
    Second Page DATA MANIPULATIONLANGUAGE DML represents a collection of programming languages explicitly used to make changes in the database.  CRUD operations to create, read, update, and delete data  Using the INSERT, SELECT, UPDATE and Delete commands. In the beginning, DML commands were par of computer programs only, but with the popularity of SQL, they have now become a part of database management. • DML have two primary classifications: Procedural and Non- procedural programming (declarative programming).
  • 7.
    SELECT: Command tofetch data or values from the database INSERT: Command to add new or fresh value to the database UPDATE: Command to change or update the present/existing data to a newer value inside the database DELETE: Command to remove or delete the values or data information from the database’s current table MERGE: Command to merge two or more data tables inside a database.
  • 8.
    SELECT COMMAND • Itis used to retrieve data from the database. • This command allows database users to retrieve the specific information they desire from an operational database. • It returns a result set of records from one or more tables. • For Example, SELECT * FROM employee where salary >=10,000; Syntax: SELECT * FROM <table_name>;
  • 9.
    INSERT COMMAND • Itis used for inserting a data into a table. • Using this command, you can add one or more records to any single table in a database. • It is also used to add records to an existing code. For Examples, INSERT INTO CUSTOMERS (ID,NAME,AGE,CITY,COMPENSATION)VALUES (1, Kritesh, 45, ‘Delhi’, 2500.00 ); INSERT INTO CUSTOMERS (ID,NAME,AGE,CITY,COMPENSATION)VALUES (2, Mehta, 35,Kochi, 1500.00 ); All the above records will fetch the following result on checking the CUSTOMERS table as following: | ID | NAME | AGE | ADDRESS | SALARY | | 1 | Kritesh | 45 | Delhi | 2500.00 || 2 | Mehta | 35 | Kochi | 1500.00 || Syntax: INSERT INTO <table_name> (`column_name1` <datatype>, `column_name2` <datatype>, . . . , `column_name_n` <database>) VALUES (`value1`, `value2`, . . . , `value n`);
  • 10.
    UPDATE COMMAND • Itis used to modify the records present in existing table. • This command updates existing data within a table. • It changes the data of one or more records in a table. UPDATE CUSTOMERSSET ADDRESS = ‘Indore’WHERE ID = 2;On checking, the customer records will fetch the following result: | ID | NAME | AGE | ADDRESS | SALARY | | 1 | Kritesh | 45 | Delhi | 2500.00 || 2 | Mehta | 35 | Indore | 1500.00 || UPDATE CUSTOMERSSET ADDRESS = ‘Indore’, SALARY = 3000.00; ID | NAME | AGE | ADDRESS | SALARY | | 1 | Kritesh | 45 | Delhi | 2500.00 || 2 | Mehta | 35 | Indore | 3000.00 || Syntax: UPDATE <table_name> SET <column_name = value> WHERE condition;
  • 11.
    DELETE COMMAND • DELETEcommand is used to delete some or all records from the existing table. • It deletes all the records from a table. SQL>DELETE FROM employee WHERE emp_id = '1'; SQL> DELETE FROM CUSTOMERS; This will delete all records of the customers from a specific database, respectively. Syntax: DELETE FROM <table_name> WHERE <condition>;