In DML(Data manipulation language) we have,
SQL> desc emp;
Name Null? Type
----------------------------------------- -------- ----------------------------
ID NUMBER(3)
NAME VARCHAR2(15)
SALARY NUMBER(5)
Insert by value method
SQL> insert into emp values(1,'kamlesh',1200);
1 row created.
Insert by address method
SQL> insert into emp values(&id,'&name',&salary);
Enter value for id: 2
Enter value for name: ravi
Enter value for salary: 1500
old 1: insert into emp values(&id,'&name',&salary)
new 1: insert into emp values(2,'ravi',1500)
1 row created.
SQL> /
Enter value for id: 3
Enter value for name: sujit
Enter value for salary: 5600
old 1: insert into emp values(&id,'&name',&salary)
new 1: insert into emp values(3,'sujit',5600)
1 row created.
SQL> /
Enter value for id: 4
Enter value for name: mohan
Enter value for salary: 7654
old 1: insert into emp values(&id,'&name',&salary)
new 1: insert into emp values(4,'mohan',7654)
1 row created.
SQL> /
Enter value for id: 5
Enter value for name: suresh
Enter value for salary: 4400
old 1: insert into emp values(&id,'&name',&salary)
new 1: insert into emp values(5,'suresh',4400)
1 row created.
SQL> select * from emp;
ID NAME SALARY
---------- --------------- ----------
1 kamlesh 1200
2 ravi 1500
3 sujit 5600
4 mohan 7654
5 suresh 4400
Update : To edit existing data we use update statement.
SQL> update emp set salary=1800 where id=4;
1 row updated.
SQL> select * from emp;
ID NAME SALARY
---------- --------------- ----------
1 kamlesh 1200
2 ravi 1500
3 sujit 5600
4 mohan 1800
5 suresh 4400
Delete : To delete all data from table we use delete statement.
SQL> delete from emp;
5 rows deleted.
SQL> select * from emp;
no rows selected
- insert
- update
- delete
SQL> desc emp;
Name Null? Type
----------------------------------------- -------- ----------------------------
ID NUMBER(3)
NAME VARCHAR2(15)
SALARY NUMBER(5)
Insert by value method
SQL> insert into emp values(1,'kamlesh',1200);
1 row created.
Insert by address method
SQL> insert into emp values(&id,'&name',&salary);
Enter value for id: 2
Enter value for name: ravi
Enter value for salary: 1500
old 1: insert into emp values(&id,'&name',&salary)
new 1: insert into emp values(2,'ravi',1500)
1 row created.
SQL> /
Enter value for id: 3
Enter value for name: sujit
Enter value for salary: 5600
old 1: insert into emp values(&id,'&name',&salary)
new 1: insert into emp values(3,'sujit',5600)
1 row created.
SQL> /
Enter value for id: 4
Enter value for name: mohan
Enter value for salary: 7654
old 1: insert into emp values(&id,'&name',&salary)
new 1: insert into emp values(4,'mohan',7654)
1 row created.
SQL> /
Enter value for id: 5
Enter value for name: suresh
Enter value for salary: 4400
old 1: insert into emp values(&id,'&name',&salary)
new 1: insert into emp values(5,'suresh',4400)
1 row created.
SQL> select * from emp;
ID NAME SALARY
---------- --------------- ----------
1 kamlesh 1200
2 ravi 1500
3 sujit 5600
4 mohan 7654
5 suresh 4400
Update : To edit existing data we use update statement.
SQL> update emp set salary=1800 where id=4;
1 row updated.
SQL> select * from emp;
ID NAME SALARY
---------- --------------- ----------
1 kamlesh 1200
2 ravi 1500
3 sujit 5600
4 mohan 1800
5 suresh 4400
Delete : To delete all data from table we use delete statement.
SQL> delete from emp;
5 rows deleted.
SQL> select * from emp;
no rows selected
0 comments:
Post a Comment