Create employee table update employee table and select and alter table employee and update department and alter table department
Create employee table**
create table employee(eid int,ename varchar2(12),age int, city varchar2(20),salary int);
insert into employee values(1,'ramesh',32,'ahmedabad',2000);
insert into employee values(2,'khilan',25,'delhi',3000);
insert into employee values(3,'khaushik',26,'bangalore',4000);
insert into employee values(4,'chitali',32,'chennai',5000);
insert into employee values(5,'hardik',31,'gurugram',2000);
insert into employee values(6,'komal',27,'idore',1000);
insert into employee values(7,'muffy',28,'bhopal',3000);
Query1*
update employee
set ename='ramesh gupta',
city='delhi'
where eid=1;
select* from employee;
Query 2*
update employee
set age=29
where salary=4000;
select*from employee;
Query3*
update employee
set phoneno=9823123423
where eid=1;
update employee
set phoneno=9323123425
where eid=2;
update employee
set phoneno=9873124523
where eid=3;
update employee
set phoneno=9853723423
where eid=4;
update employee
set phoneno=9824123421
where eid=5;
update employee
set phoneno=9626123423
where eid=6;
update employee
set phoneno=9823523426
where eid=7;
select*from employee;
Create department table**
create table department(eid int,ename varchar2(10),department varchar2(10),contactno number(10));
insert into department values(101,'isha','e101',9817127844);
insert into department values(102,'priya','e104',9887127544);
insert into department values(103,'neha','e105',9887137554);
insert into department values(104,'rahul','e102',9847337554);
insert into department values(105,'abhishek','e101',8787337554);
Query 4*
SELECT*from department
where department='e104'
or
department='e102';
Query 5*
update department
set ename='isha yadav'
where eid=101;
select*from department;
Query6*
delete from department
where ename='abhishek';
select*from department;
Query 7*
alter table department
add departmentname varchar2(10);
update department
set departmentname='cse'
where department='e101';
update department
set departmentname='me'
where department='e102';
update department
set departmentname='ba'
where department='e104';
update department
set departmentname='ec'
where department='e105';
select*from department;
Comments
Post a Comment