create table emp(empno int(4)primary key,empname varchar(30) NOT NULL,age int,designation varchar(40),sal decimal(12,2));
insert into emp values(1,'udita singh',28,'s/w eng.',75000);
insert into emp values(2,'kiran ambekar',25,'project man.',12000.75);
insert into emp values(3,'priya mehta',35,'analyst',68000.00);
select * from emp;
select * from emp where age>30 and sal>50000;
select empname, designation, sal from emp order by empname desc;
select max(sal) from emp;
select designation,count(*) from emp group by designation having count(*)=1;
insert into emp values(4,'nuatan ambekar',25,'project man.',21000.75);
select * from emp;
select designation,count(*) from emp group by designation having count(*)=1;
update emp set sal=130000 where empno=2;
select * from emp;
alter table emp add(state varchar(30)NOT NULL);
update emp set state='kolkata' where empno=1;
update emp set state='delhi' where empno=2;
update emp set state='bengal' where empno=3;
update emp set state='maha' where empno=4;
select * from emp;
select avg(sal) from emp;
select max(sal)from emp;
select min(sal)from emp;
select sum(sal)from emp;
select count(empno)from emp;
select count(*)"no. of records" from emp;
select abs(-40) from dual;
select power(2,2) from dual;
select sqrt(4) from dual;
select round(2.43,1) from dual;
select to_char(12345,'999,999')from dual;