Structure Query Language, C programming, Java, Servlet, Jsp, Unix

Friday 30 March 2012

Query Using Date.


1) Display the order no and day on which client placed their order.

select s_order_no,to_char(s_order_date,'day')"Day Name" from sales_order;

2) Display the month (in alphabets)and date when the order must be delivered.

select to_char(dely_date,'month')"Month Name",dely_date from sales_order
order by to_char(dely_date,'month');

3) Display s_order_date in the format "dd-month-yy" e.g 12-February-96.

select to_char(s_order_date,'DD-Month-YY') "Date format" from sales_order;

4) Find the date,fifteen days after todays date.

select sysdate+15 from dual;

5) Find the no of days elapsed between today date and the delivery date of the orders placed by the client.

select c.client_no ,(sysdate-s.dely_day) from sales_order s,client_master c where c.client_no=s.client_no;

No comments:

Post a Comment