SQL> create table client_master(client_no number(10),name varchar(10), address varchar(20),city varchar(10),state varchar(10),remarks varchar(10),bal_due number(5,2));
Table created.
SQL> desc client_master
Name | Null? | Type |
CLIENT_NO | | NUMBER(10) |
NAME | | VARCHAR2(10) |
ADDRESS | | VARCHAR2(20) |
CITY | | VARCHAR2(10) |
STATE | | VARCHAR2(10) |
REMARKS | | VARCHAR2(10) |
BAL_DUE | | NUMBER(5,2) |
SQL> create table supplier_master as select * from client_master;
Table created.
SQL> desc supplier_master;
Name | Null? | Type |
CLIENT_NO | | NUMBER(10) |
NAME | | VARCHAR2(10) |
ADDRESS | | VARCHAR2(20) |
CITY | | VARCHAR2(10) |
STATE | | VARCHAR2(10) |
REMARKS | | VARCHAR2(10) |
BAL_DUE | | NUMBER(5,2) |
SQL> alter table supplier_master rename column client_no to supplier_no;
Table altered.
SQL> alter table supplier_master rename column name to supplier_name;
Table altered.
SQL> desc supplier_master;
Name | Null? | Type |
SUPPLIER_NO | | NUMBER(10) |
SUPPLIER_NAME | | VARCHAR2(10) |
ADDRESS | | VARCHAR2(20) |
CITY | | VARCHAR2(10) |
STATE | | VARCHAR2(10) |
REMARKS | | VARCHAR2(10) |
BAL_DUE | | NUMBER(5,2) |
SQL> insert into client_master values(001,'xxx','mha nagar','vellore','TN','delivered',600);
1 row created.
SQL> insert into client_master values(002,'yyy','bun street','chennai','TN','cash paid',500.45);
1 row created.
SQL> insert into client_master values(003,'zzz','main road','mumbai','MRA','pending',600);
1 row created.
SQL> select * from client_master;
CLIENT_NO | NAME | ADDRESS | CITY | STATE | REMARKS | BAL_DUE |
1 | xxx | mha nagar | vellore | TN | delivered | 600 |
2 | yyy | Bun street | chennai | TN | cash paid | 500.45 |
3 | zzz | main road | mumbai | MRA | pending | 600 |
SQL> insert into supplier_master select * from client_master;
3 rows created.
SQL> select * from supplier_master;
SUPPLIER_NO | SUPPLIER_NAME | ADDRESS | CITY | STATE | REMARK | BAL_DUE |
1 | Xxx | mha nagar | vellore | TN | delivered | 600 |
2 | Yyy | Bun street | chennai | TN | cash paid | 500.45 |
3 | Zzz | main road | mumbai | MRA | pending | 600 |
SQL> delete from client_master where client_no=002;
1 row deleted.
SQL> select * from client_master;
CLIENT_NO | NAME | ADDRESS | CITY | STATE | REMARKS | BAL_DUE |
1 | xxx | mha nagar | vellore | TN | delivered | 600 |
3 | zzz | main road | mumbai | MRA | pending | 600 |
No comments:
Post a Comment