Display consumer no(cno) , meter no(mno) and bill amount(bill) where the consumer no is odd from Electric table
select cno,mno,bill
from electric
where mod(cno,2)!=0;
display all the rows in the ascending order of bill amount(bill) from electric table
select * from electric
order by bill;
Display all the rows from the table employees where employee number(empid) is divisible by 5
select * from employees
where mod(empid,5);
Display the name(enm) and hire date(hdt) of all the employees from Employee table who do not have a manager.
select enm,hdt
from employee
where mgrid is null;
display the employee name(enm) labeled as 'Name of the Employee' and salary(sal) as 'Monthly salary' from employee table
select enm 'Name of the employee', sal 'Monthly salary'
from employee;
display the employee id(eid), job id(job_id) and salary(sal) of all employees whose manager id (mgrid) is 505 or 509 from employee table
select eid,job_id,sal
from employee
where mgrid in(505,509);
display the employee id(eid) employee name(enm) and salary(sal) of employees from employee table whose salary is 25000 or more
select eid,enm,sal
from employee
where sal>=25000;
display all the rows in the descending order of hire date(hdt) from employee table
select * from employee
order by hdt desc;
Display all the rows from employee table where the second letter in the employee name(enm) is 'H'
select * from employee
where enm like '_H%';
Display the permanent account number(pan), income tax(inc) and 10% of income tax as 'Surcharges' from tax table
select pan,inc,inc*.10 as surcharges from tax;
Display all the rows from the table tax where name(enm) contains 'B'
select * from tax
where enm like'%B%';
Display all the rows from table customer where the customer number(cno) is divisible by 4
select * from customer
where mod(cno,4);
display roll number(rno), student name(snm) and marks(mrks) of students born before date(dt) march 10,1998 from table student
select rno,snm,mrks
from student
where dt<'1998-03-10';
display roll no(rno), student name(snm) and marks(mrks) from student table where student name (snm) is 'Aditya chopra'
select rno,snm,mrks
from student
where snm='Aditya chopra';
Display all the rows from the table student where the first letter of student name(snm) is 'F'
select * from student
where snm like'F%';
display employee number(eno) and bonus(bonus) in the ascending order of employee number from table incent
select eno,bonus from incent
order by eno , bonus;
display total number of deposits and maximum amount deposited from table deposit(acno,cname,d_amt,ddate,p_dep)
select count(acno),max(d_amt)
from deposit;
display customers name(cnm) in capital letters, year of deposit(yod) and the amount deposited(amt) from deposit
select upper(cnm),yod,amt
from deposit;
display the customer name(cnm) and amount deposited(amt) where the amount deposited is either 100000 or 300000 from deposit table
select cnm,amt
from deposit
where amt in(100000,300000);
increase the number of lectures attended(ltotal) by all the students by 5 in attend table
update attend
set ltotal=lotatl+5;
alter table tyclass
add divi char(1) after snm;
explain dayname() function with definition,syntax and example
dayname() function is used to find the name of the day from the given date
select dayname(date);
select dayname('2019-07-23');
o/p: Tuesday
display the structure of table tyclass
desc tyclass;
rename the table tyclass to tybcomclass
rename table tyclass to tybcomclass;
display all the rows from the table travel where the passenger's name(pnm) starts with 'a' and ends with 't'
select * from travel
where pnm like'a%t';