BASIC SELECT QUERIES & IN-BULIT FUNCTION

 1.Write a query to display all the fields of the 'bill' whose payment is not completed. Display the records in ascending order based on due_date.

ANS: select  * from bill where is_payed=0 order by due_date;

2.Write a query to display all the details of all the 'bills' whose payment_date is on the year 2018, sorted by payable_amount in descending order.
ANS:
select *from bill
where payment_date  like '%18'
order by payable_amount desc;

3.Write a query to display all the details of all the 'bills' whose payment_date is on the year 2018, sorted by payable_amount in descending order.
select owner_name, address,contact_number from building where email_address is null order by owner_name;

4.Write a query to display the meter_id and total_units of electricity_reading whose '13th' hour reading is lesser than the '14th' hour reading, Display the records in descending order based on their total_units.
select meter_id ,total_units from electricity_reading where h13<h14 order by total_units desc;

5.Write a query to display all the fields of the 'meter' whose meter_number starts with 'S' and ends with '6'.
ANS select *from meter where meter_number like 'S%6';
Tags

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.