Sei sulla pagina 1di 6

SQL> create table bankdet(acno numeric(5) primary key,holdername varchar(10),age

numeric(3));

Table created.

SQL> desc bankdet;


Name Null? Type
----------------------------------------- -------- ----------------------------

ACNO NOT NULL NUMBER(5)


HOLDERNAME VARCHAR2(10)
AGE NUMBER(3)
Gender VARCHAR(10)
Place VARCHAR(10)

SQL> alter table bankdet add(gender varchar(10),place varchar(10));

Table altered.

SQL> alter table bankdet modify(gender varchar(15),place varchar(15));

Table altered.

SQL> insert into bankdet values(1234,'ksp.


2
SQL> insert into bankdet values(1234,'ksp',15,'male','salem');

1 row created.

SQL> select * from bankdet;

ACNO HOLDERNAME AGE GENDER PLACE


---------- ---------- ---------- --------------- ---------------
1234 ksp 15 male salem
SQL> select * from bankdet;

ACNO HOLDERNAME AGE GENDER PLACE


---------- ---------- ---------- --------------- ---------------
1234 ksp 15 male salem
4321 kspr 18 male omalur

SQL> insert into bankdet1 values(431,'koki',18,'female','che');

1 row created.

SQL> insert into bankdet1 values(4312,'mithu',18,'female','mad');


1 row created.

SQL> select * from bankdet1;

ACNO HOLDERNAME AGE GENDER LOCATION


---------- ---------- ---------- --------------- ---------------
4321 kspr 18 male omalur
1234 ksp 15 male salem
431 koki 18 female che
4312 mithu 18 female mad

SQL> update bankdet set place='chennai' where acno=1234;

1 row updated.

SQL> select * from bankdet;

ACNO HOLDERNAME AGE GENDER PLACE


---------- ---------- ---------- --------------- ---------------
1234 ksp 15 male chennai
4321 kspr 18 male omalur

SQL> update bankdet1 set holdername='shan' where acno=1234;

1 row updated.

SQL> select * from bankdet1;

ACNO HOLDERNAME AGE GENDER LOCATION


---------- ---------- ---------- --------------- ---------------
4321 kspr 18 male omalur
1234 shan 15 male salem
431 koki 18 female che
4312 mithu 18 female mad

SQL> delete from bankdet where acno=4321;

1 row deleted.

SQL> select * from bankdet;

ACNO HOLDERNAME AGE GENDER PLACE


---------- ---------- ---------- --------------- ---------------
1234 ksp 15 male chennai

SQL> delete from bankdet where acno=4321;

1 row deleted.

SQL> select * from bankdet;

ACNO HOLDERNAME AGE GENDER PLACE


---------- ---------- ---------- --------------- ---------------
1234 ksp 15 male chennai
SQL> truncate table bankdet;

Table truncated.

SQL> select * from bankdet;

no rows selected

SQL> select * from bankdet;


select * from bankdet
*
ERROR at line 1:
ORA-00942: table or view does not exist

SQL> select * from bankdet1;

ACNO HOLDERNAME AGE GENDER PLACE


---------- ---------- ---------- --------------- ---------------
4321 kspr 18 male omalur
1234 ksp 15 male salem

SQL> commit;

Commit complete.

SQL> insert into bankdet values(43,'ks',18,'male','cbe');


insert into bankdet values(43,'ks',18,'male','cbe')
*
ERROR at line 1:
ORA-00942: table or view does not exist

SQL> insert into bankdet1 values(43,'ks',18,'male','cbe');

1 row created.

SQL> select * from bankdet1;

ACNO HOLDERNAME AGE GENDER PLACE


---------- ---------- ---------- --------------- ---------------
4321 kspr 18 male omalur
1234 ksp 15 male salem
43 ks 18 male cbe

SQL> rollback;

Rollback complete.

SQL> select * from bankdet1;

ACNO HOLDERNAME AGE GENDER PLACE


---------- ---------- ---------- --------------- ---------------
4321 kspr 18 male omalur
1234 ksp 15 male salem

SQL> alter table bankdet1 rename column place to location;

Table altered.

SQL> select * from bankdet1;

ACNO HOLDERNAME AGE GENDER LOCATION


---------- ---------- ---------- --------------- ---------------
4321 kspr 18 male omalur
1234 ksp 15 male salem
SQL> insert into bankdet1 values(4321,'kspr',18,'male','omalur');

1 row created.

SQL> insert into bankdet1 values(1234,'ksp',15,'male','salem');

1 row created.

SQL> select * from bankdet1;

ACNO HOLDERNAME AGE GENDER PLACE


---------- ---------- ---------- --------------- ---------------
4321 kspr 18 male omalur
1234 ksp 15 male salem

SQL> commit:
2
SQL> commit;

Commit complete.

SQL> insert into bankdet values(43,'ks',18,'male','cbe');


insert into bankdet values(43,'ks',18,'male','cbe')
*
ERROR at line 1:
ORA-00942: table or view does not exist

SQL> insert into bankdet1 values(43,'ks',18,'male','cbe');

1 row created.

SQL> select * from bankdet1;

ACNO HOLDERNAME AGE GENDER PLACE


---------- ---------- ---------- --------------- ---------------
4321 kspr 18 male omalur
1234 ksp 15 male salem
43 ks 18 male cbe

SQL> rollback;

Rollback complete.

SQL> select * from bankdet1;

ACNO HOLDERNAME AGE GENDER PLACE


---------- ---------- ---------- --------------- ---------------
4321 kspr 18 male omalur
1234 ksp 15 male salem