0% found this document useful (0 votes)
12 views

New Text Document

The document contains SQL commands to create tables, insert data, update, delete and alter tables. It creates tables to store student, product, client and salesman data. It populates the student and student2 tables with data and performs operations like select, update, delete on them. It also alters some tables by adding, modifying or dropping columns.

Uploaded by

Tista Bhaduri
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

New Text Document

The document contains SQL commands to create tables, insert data, update, delete and alter tables. It creates tables to store student, product, client and salesman data. It populates the student and student2 tables with data and performs operations like select, update, delete on them. It also alters some tables by adding, modifying or dropping columns.

Uploaded by

Tista Bhaduri
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

create table client_master(client_no varchar2(6),name varchar2(20),place

varchar2(20),city varchar2(20),state varchar2(20),bal_due number(10,2))

create table product_master(product_no varchar2(6),product_name


varchar2(20),profit_percentage number(5,2),unit_measure varchar2(10),qty_on_hand
number(10,2),sale_price number(10,2),cost_price number(10,2))

create table salesman_master(salesman_no varchar2(6),salesman_name


varchar2(20),place varchar2(20),city varchar2(20),state varchar2(20),pin
varchar2(20),sale_amt number(10,2),target_amt number(10,2),yet_to_sale
number(10,2),remark varchar2(60))

alter table client_master add(pin varchar2(40))

alter table salesman_master modify(place varchar2(60))

alter table product_master drop column profit_percentage

alter table client_master rename column pin to pincode

create table student(roll number(8),name varchar2(20),age number(2),branch


varchar2(20))

insert into student(roll,name,age)values(101,'Vikas',19)


insert into student(roll,name,age)values(102,'Soheb',20)
insert into student(roll,name,age)values(103,'Gita',18)
insert into student(roll,name,age)values(104,'Liza',19)
insert into student(roll,name,age)values(105,'Ganesh',20)

select * from student

update student set branch='IT' where roll=101

delete from student where roll=101

create table person as select roll,name,age from student where roll=102 or roll=103

select * from person

create table student2(slno number(5),stud_id varchar2(10),stud_name


varchar2(30),address varchar2(30),mobile_no varchar2(30),course_name
varchar2(30),course_fee number(10,2))

insert into
student2(slno,stud_id,stud_name,address,mobile_no,course_name,course_fee)values(1,1
00,'Shreya','Mumbai','9144559908','BCA',60000.00)

insert into
student2(slno,stud_id,stud_name,address,mobile_no,course_name,course_fee)values(2,1
01,'Rahul','Kolkata','9144559908','MCA',70000.00)

insert into
student2(slno,stud_id,stud_name,address,mobile_no,course_name,course_fee)values(3,1
06,'Riya','Ranchi','9155997708','Bsc',50000.00)

insert into
student2(slno,stud_id,stud_name,address,mobile_no,course_name,course_fee)values(4,1
18,'Aayan','Jaipur','8140669908','BCA',60000.00)
insert into
student2(slno,stud_id,stud_name,address,mobile_no,course_name,course_fee)values(5,2
00,'Vivek','Delhi','7944323208','Btech',160000.00)

insert into
student2(slno,stud_id,stud_name,course_name,course_fee)values(6,201,'Sharon','BCA',
60000.00)

insert into
student2(slno,stud_id,stud_name,course_name,course_fee)values(7,202,'Raunak','MCA',
70000.00)

insert into
student2(slno,stud_id,stud_name,course_name,course_fee)values(8,203,'Ayantika','Bte
ch',160000.00)

insert into
student2(slno,stud_id,stud_name,course_name,course_fee)values(9,204,'Sayan','BFD',9
0000.00)

insert into
student2(slno,stud_id,stud_name,course_name,course_fee)values(10,251,'Pratik','MA',
30000.00)

select * from student2

update student2 set mobile_no='2441139' where mobile_no is null

delete from student2 where mod(slno,2)!=0

alter table student2 modify(stud_id varchar2(20))

alter table student2 add(email varchar2(20))

update student2 set email='rahul@gmail' where slno=2

update student2 set email='ayan@gmail' where slno=4

update student2 set email='sharon67@gmail' where slno=6

update student2 set email='ayantika78@yahoo' where slno=8

update student2 set email='pratik32@gmail' where slno=10

You might also like