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

Friday 30 March 2012

Set functions and concatenation.


1) Count the total no. of orders.

select count(*) from sales_order ;

2) Calculate the average price of all the products.

select round(avg(sell_price))as  "average price" from product_master ;

3) Calculate the minimum price of product

select min(sell_price)from product_master ;

4) Determine the maximum and minimum product price.Rename the title as max_price and min_price respectively.

select max(sell_price)"max_price",min(sell_price)"min_price"from product_master;

5) Count the number of product having price greater than or equal to 1500.

select count(*)from product_master where sell_price>=1500 ;

6) Find all products whose qty_on_hand is less than recorder level.

select product_no,description,qty_on_hand from product_master where qty_on_hand < recorder_lvl ;

7) Print the information of client_master,product_master,sales_order table in the following format for all the record.{cust_name}has placed order {order_no}on {s_order_date}.

select name|| ' has placed an order '  || s_order_no || ' on ' || s_order_date from client_master, sales_order where sales_order.client_no=client_master.client_no;

No comments:

Post a Comment