0% found this document useful (0 votes)
27 views3 pages

Implement Data Manipulation Language Commands - Insert, Select, Update, and Delete

This document discusses and provides examples of the four basic Data Manipulation Language (DML) commands: INSERT, SELECT, UPDATE, and DELETE. It explains how to use each command to add, retrieve, modify, and remove records from a database table. Syntax examples are given to demonstrate inserting single and multiple records, selecting specific columns or rows that meet conditions, updating column values for one or all rows, and deleting a single row or all rows from a table.

Uploaded by

Manendra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views3 pages

Implement Data Manipulation Language Commands - Insert, Select, Update, and Delete

This document discusses and provides examples of the four basic Data Manipulation Language (DML) commands: INSERT, SELECT, UPDATE, and DELETE. It explains how to use each command to add, retrieve, modify, and remove records from a database table. Syntax examples are given to demonstrate inserting single and multiple records, selecting specific columns or rows that meet conditions, updating column values for one or all rows, and deleting a single row or all rows from a table.

Uploaded by

Manendra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Aim:

Implement Data Manipulation Language commands - Insert, Select, Update, and Delete.

1. INSERT:
Purpose:
To add records to the table
Syntax:
a.Direct method-
only one record can be inserted in the field at a time
• Insert into<table name>values<values for all columns>;
Example queries:
insert into employee values(3,'Brindha',123,9100,'CSE');
OUTPUT:
1 row inserted.

b.Null method-
we can skip some field
• Insert into<table name>(column name)values(values for columns);
Example queries:
insert into employee(eno,sal) values(11,5000);
OUTPUT:
1 row inserted.

c.Macro method-
More than one value can be inserted in the field at a time.
• Insert into<table name>values<&column names>;
Example queries:
Command to insert records into employee table.
SQL >.insert into employee values ( &eno, ’&ename’ ,&dno ,&sal, ‘&dname’); Enter value for eno:1
Enter value for ename:D.Abinaya
Enter the value for dno:111
Enter the value sal:8000
Enter the value for dname:IT
Old 1:insert into employee values(&eno,’&ename’,&dno,&sal,’&dname’ New 1:insert into employee
values(1,’D.Abinaya’,111,8000,’IT’)
Output:
1 row created
To execute the command which is in buffer
SQL>/
Enter value for eno:2
Enter value for ename: P.Ratha
Enter value for dno:111
Enter value for sal:8900
Enter value for dname:IT
Old 1: insert into employee values (&eno,’&ename’,&dno,&sal,’&dname’); New 1: insert into
employee values (2,’P.Ratha’,111,8900,’IT’)
Output:
1 row created
2. SELECT:
Purpose: Syntax:
To retrieve or view records with in the table
Syntax:
• Select * from<table name>
Example queries:
select * from employee;
Output:
ENO ENAME DNO SAL DNAME
---------------------------------------------
1 Abinaya 111 8000 IT
2 P.Ratha 111 8900 IT
3 Brindha 123 9100 CSE
4 Ajay 123 9110 CSE
5 Indira 145 7500 AI
6 Adhi 145 7900 AI
8 Harsha 132 9900 EIE
9 Mithuna 133 8900 EIE
10 Sahana 133 9990 EIE
11 5000

10 rows selected.
• Select *from <table name> where(condition)
Example queries:
Display enmae,dno from employee where sal>9000.
SQL>Select ename,dno from employee where sal>9000;
Output:
ENAME DNO
-----------------
Brindha 123
Ajay 123
Harsha 132
Sahana 133
4 rows selected.
• Select (column name) from<table name>
Example queries:
Find out the names of all the employees
SQL>select ename from employee;
Output:
ENAME
---------------
D.Abinaya
P.Ratha
Brindha
Ajay
Indira
Adhi
Harsha
Mithuna
Sahana
10 rows selected
3. UPDATE:
Purpose:
To modify records with in the table
Syntax:
• Update<table name>set(column name)=(value)where(condition)
Example queries:
SQL> update employee set ename='Raju' where eno=11;
OUTPUT:
1 row updated.

• Update<table name>set(column name)=(value);


Example queries:
updating all values of the column
SQL> update employee set sal=9000;
OUTPUT:
11 rows updated.

4. DELETE:
Purpose:
To modify records from a table.
Syntax:
• Delete from<table name>where(condition)
Example queries:
Delete a specific record from the table.
SQL> delete from employee where ename='Ajay';
OUTPUT:
1 row deleted.

• Delete from<table name>


Example queries:
Delete all rows in a table without deleting the table
SQL> delete from employee;
OUTPUT:
10 rows deleted.

Result:
Thus, DML Queries were executed.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy