What is the difference between SQL, DDL, and DML?
Answer Posted / g srikanth
1. DML COMMANDS
DML is abbreviation of Data Manipulation Language. It is
used to retrieve, store, modify, delete, insert and update
data in database.
INSERT ROWS
The syntax for this command is
insert into tablename(colname1,colname2) values(value1,value2);
Example:
insert into Student (id, Name) values(1,'Ravi');
This statement is used to insert a row of data into Student
table.
UPDATE ROWS
The syntax for this command is
update tablename set colname1=colvalue where colname2=colvalue;
Example:
update Student set Name = 'Ajay' where id = 2;
This command has updated the Name 'Rose' in Student table
whose id is 2.
SELECT ROWS
This command is used to select rows from a table.The syntax
for this command is
select colname1,colname2 from tablename;
Example:
select Name from Student;
It will display all names from Student table. Like Ravi.
DELETE ROWS
The syntax for this command is-
delete from tablename where [search_conditions];
Example:
delete from Student where id=1;
This statement is used to delete the row from Student table
where the student id is 1.
2. DDL COMMANDS
DDL is abbreviation of Data Definition Language. It is used
to create and modify the structure of database objects in
database.
CREATE TABLE
This statement is used to create a table. The syntax for
this command is
create table tablename (colname1 datatype [constraint],
colname2 datatype [constraint]);
Example:
create table Student (id number(4) primary key, Name
varchar2(20));
It creates the table Student which has two fields id i.e.
Student id and Name i.e. the student name. The number and
varchar2 are the data types of id and Name respectively.
Field 'id' has the size 4 means it can take id up to 4
digits and same for Name, it can take the size up to 20
characters. And also added the constraint Primary key to the
field 'id'.
ALTER TABLE
This command is used to add, drop columns in a table. The
syntax for this command is
alter table tablename add colname1 datatype [constraint];
alter table tablename drop column colname1;
Example:
alter table Student add DOB date;
This command is used to add new field DOB in Student table.
It's datatype is date. This is also used for drop column
from the table. It will drop the DOB field by query given below-
Alter table Student drop column DOB;
DROP TABLE
The syntax for this command is-
drop table tablename;
Example:
drop table Student;
This statement is used for destroy the table from database.
| Is This Answer Correct ? | 25 Yes | 3 No |
Post New Answer View All Answers
How to execute a stored procedure in oracle?
What is an oracle transaction?
What are the ways tablespaces can be managed and how do they differ?
what is insert all statement in sql
How to pass parameters to procedures in oracle?
Is it possible to center an object horizontally in a repeating frame that has a variable horizontal size ?
Explain what are the uses of rollback segment?
How do I limit the number of oracle database connections generated by weblogic server?
Why we use bulk collect in oracle?
What is the difference between online and offline backups?
How to create an oracle testing table?
Explain the use of online redo log files in oracle.
Her departmandaki isçilerden empno' su ikinci sirada olan isçilerin empno, deptno, hiredate, sira_no bigilerini döndüren sorguyu yaziniz?
How to build data dictionary view an new database?
Point the difference between translate and replace?