Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

MOBILE MANAGEMENT SYSTEM

1. Write a Query to Display the IME Number, Model Name of mobiles which is manufactured by
"Nokia".

Select IME_No,Model_Name from mobile_master where Manufacturer="Nokia";

2. Write a Query to display IME number, Model Name, Manufacturer and Camera Quality of
mobiles whose camera quality is 5MP.

select m.IME_No,m.Model_Name,m.Manufacturer,s.Camera_Quality from mobile_master


m,mobile_specification s where m.IME_No=s.IME_no and s.Camera_Quality="5MP";

3. "Write a Query to display the Mobile Model Name and respective number of mobiles sold on
the date 23-Apr-2012 for each mobile model.

<br/> Hint: For example, if 2 ""Nokia 1100"" and 1 ""Nokia C5-03"" are sold on the date 23-Apr-2012
then display both the records. Use ""NoofMobilesSold"" as alias name for the number of mobiles
field."

Select m.Model_Name,count(m.Model_Name) as Noofmobilessold from mobile_master m,sales_info s


where m.IME_No=s.IME_No and s.Sales_Date="2012-4-23" group by m.Model_Name;

4. "Write a Query to display the distributor id, mobile model name, number of mobiles of the
particular model name supplied to the distributors group by model name and distributor id and sort
by the distributor id.

<br/> Hint: For example, if 3 ""Nokia 1100"" and 1 ""Nokia C5-03"" are sold to one distributor then
display both the records. <br/>Display the distributor id, model name and number of mobiles of a
particular model name. <br/>Use ""NoofMobilesSupplied"" as alias name for the number of mobiles."

Select d.Distributor_ID,m.Model_Name,count(m.Model_Name) as Noofmobilessupplied from


distributor d, mobile_master m where d.Distributor_ID=m.Distributor_ID group by m.Model_Name
order by d.Distributor_ID;

5. "Write a Query to display the IME number, model name, manufacturer, price and discount of all
mobiles regardless of whether the mobile is sold or not. <br/> Hint: Fetch the price, IME no and model
name from mobile_master table. <br/>

Example: For the mobile model ""Samsung GalaxyTAB with IME NO ""MC1000103"" is sold and other
with IME No ""MC1000110"" is not sold. <br/>Then both the mobiles details namely IME number,
model name, manufacturer, price and discount needs to be displayed. "
select m.IME_No,m.Model_Name,m.Manufacturer,m.price,s.discount from mobile_master m,sales_info
s where m.IME_No=s.IME_no;

6. Write a Query to display the distributor name, mobile number and email of distributors selling
model 'Nokia 1100'.

Select d.Distributor_Name,d.Mobilenumber,d.Email from distributor d, mobile_master m where


d.Distributor_ID=m.Distributor_ID and m.Model_Name="Nokia 1100";

7. Write a Query to display the IME Number and Model Name of mobiles which are not sold. <br/>
Hint: The details of the sold mobiles are available in the "SALES_INFO" table and the overall mobile
models are available in the mobile_master table.

Select m.IME_No,m.Model_Name from mobile_master m where m.IME_No NOT IN (Select IME_No


from sales_info);

8. Write a Query to display the IME Number, Model Name and net amount of the mobile which has
the highest net amount.

9. "Write a Query to display the IME Number, Model Name, Manufacturer, Price and New Price of
all mobiles. <br/> Hint: Fetch the price, name and IME number from mobile master table. <br/> Add
10% to the old price to find new price and display with alias name ""NewPrice"". Formula = price +
(price * 10/100)"

Select m.IME_No,m.Model_Name,s.Net_Amount from mobile_master m,sales_info s where


m.IME_No=s.IME_No and s.Net_Amount =(Select max(s.Net_Amount) from sales_info s);Select
IME_No,Model_Name,Manufacturer,Price,Round((Price*11/10),2) as New_Price from mobile_master;

10. Write a Query to display mobile model name, manufacturer and price for the mobiles having a
price range between 8500 and 25300.

Select IME_No,Model_Name,Manufacturer,Price from mobile_master where Price between 8500 And


25300;
11. Write a Query to display the Model Name, Manufacturer, Price, Warranty, Internal memory,
memory card capacity, gprs support, Bluetooth, camera quality and OS for the mobile with IME NO
"MC1000104"

Select m.Model_Name, m.Manufacturer, m.Price, m.Warranty_in_Years, s.Internal_mem_in_MB,


s.Memory_Card_Capacity_GB, s.GPRS, s.Bluetooth, s.Camera_Quality , s.OS from mobile_master
m,mobile_specification s where m.IME_No=s.IME_No and m.IME_No="MC1000104";

12. "Write a Query to display IME Number, Model Name, Manufacturer, Price ,GPRS information,
Memory card capacity of mobiles which has GPRS support with memory card capacity 16GB or
above.<br/>

Hint: For GPRS support use GPRS = Yes."

Select m.IME_No,m.Model_Name, m.Manufacturer, m.Price, s.Memory_Card_Capacity_GB, s.GPRS


from mobile_master m,mobile_specification s where m.IME_No=s.IME_No and s.GPRS="Y" and
s.Memory_Card_Capacity_GB="16";

13. Write a Query to display the customer name, IME Number, Model Name, Sales Date and Net
amount paid by the customer and sort by customer name in ascending order.

select c.Customer_Name,m.IME_No,m.Model_Name,s.Sales_Date,s.Net_Amount from mobile_master


m,sales_info s,customer_info c where m.IME_No=s.IME_No and s.Customer_ID=c.Customer_ID order by
c.Customer_Name;

14. "Write a Query to display the IME Number, model name, manufacturer, price and discount of all
mobiles regardless of whether the mobile is sold or not. <br/> Hint: If not sold, display discount as
""Not Sold""<br/>

Hint: Fetch the price and model name from mobile_master table. <br/>Use discount as alias name
for displaying the discount of all mobiles."

Select m.IME_No,m.Model_Name, m.Manufacturer, m.Price,coalesce(s.Discount,'Not Sold') as Discount


from mobile_master m left outer join sales_info s on m.IME_No=s.IME_No;

15. Write a Query to display the sales date and total net amount of all the mobiles based on the sales
date that are sold between 20-APR-12 and 25-APR-12. <br/> Hint: Total net amount column should be
displayed as "TotalNetAmount" (alias)
Select s.Sales_Date,count(s.IME_No) as Sales_Count from sales_info s where s.Sales_Date Between
"2012-4-20" and "2012-4-25";

16. Write a Query to display mobile IME number, model name, manufacturer, price and battery life
of the mobiles which are having the longest battery life. <br/> Hint: Use the field "battery_life_hrs"
for calculating maximum battery life.

Select m.IME_No,m.Model_Name,m.Manufacturer,m.Price from mobile_master m,mobile_specification


s where m.IME_No=s.IME_No and Battery_Life_Hrs=(Select max(Battery_Life_Hrs) from
mobile_specification);

17. Write a Query to display the IME Number, Model Name, Manufacturer and Price of the mobile
which is having the maximum price. <br/> Hint: Assume 2 mobiles have highest price then both the
mobiles should be displayed.

Select c.Customer_Name,c.Customer_ID,c.Address,sum(s.Net_Amount) as Total_Net_Amount from


customer_info c,sales_info s where c.Customer_ID=s.Customer_ID group by s.Customer_ID;

18. Write a Query to display the Customer ID, Customer Name, Address, Total net amount of each
customer. <br/>For example, assume customer_1 has purchased 2 mobiles such as "Nokia C5-03" and
"Nokia Lumia" then sum the prices of both the mobiles and should be displayed against his customer
id. <br/> Hint: Use Total_Net_Amount as alias.
select c.Customer_ID,c.Customer_Name,c.Address,sum(Net_Amount) as Total_Net_Amount
from customer_info c join sales_info s on c.customer_id=s.customer_id
group by customer_id;

19. Write a Query to display the unique mobile model, manufacturer and price of the mobile which
has highest price and manufactured by "Samsung".

Select m.Model_Name,m.Manufacturer,m.price from mobile_master m where


m.Manufacturer="Samsung" order by m.Price Desc Limit 1;

20. Write a Query to display the IME number, model name, manufacturer, distributor id, distributor
name and price supplied by the distributor named 'AXA Ltd'.

Select m.IME_No,m.Model_Name,m.Manufacturer,d.Distributor_ID,d.Distributor_Name from


mobile_master m,Distributor d where m.Distributor_ID=d.Distributor_ID and d.Distributor_Name="AXA
Ltd";
21. Write a Query to display the distributor id, name, address , mobile no, email of the distributor
who has supplied the maximum number of mobiles. <br/> Hint: Get the maximum number of mobile
provided by a distributor from mobile master and use it to get the details.

Select * from Distributor where Distributor_ID=(Select Distributor_ID from mobile_master group by


Distributor_ID order by count(IME_No) desc limit 1);

22. "Write a Query to display the Customer ID, Customer Name and Address of the customers who
have purchased the maximum amount.

<br/> Hint: Sum the net amount for the each customer for all the purchases and find the customer
who has maximum amount. And display the details of all the customers who has purchase amount
equal to the maximum amount."

Select c.Customer_ID, c.Customer_Name,c.Address from customer_info c where c.Customer_ID IN


(Select Customer_ID from sales_info group by Customer_ID having sum(Net_Amount)=(Select
max(Amount) from (Select Sum(Net_Amount) as Amount from sales_info group by Customer_ID)t));

23. Write a Query to determine whether the mobile "Samsung GalaxyTAB" has been sold out or not
and display the model name, ime_no and sales status. If sold display status as "Sold Out" else display
"-"with column name "SalesStatus" (alias).

Select m.Model_Name,m.IME_No,'Sold Out' as Sales_Status from mobile_master m where


m.Model_Name="SamsungGalaxyTAB" and m.IME_No IN (Select IME_No from sales_info) union Select
m.Model_Name,m.IME_No,'-' as Sales_Status from mobile_master m where
m.Model_Name="SamsungGalaxyTAB" and m.IME_No NOT IN (Select IME_No from sales_info);

24. Write a Query to display the distinct distributor id, distributor name, address, mobile of all the
distributors who supplies mobile with the following specifications network should support 3G
Network and OS should be Android and camera quality should be 3.5 MP Camera. <br/> Hint: The
above specifications are found in the "Mobile_Specification" table.

Select distinct d.Distributor_ID,d.Distributor_Name,d.Address,d.Mobilenumber from distributor


d,mobile_master m,mobile_specification s where d.Distributor_ID=m.Distributor_ID and
m.IME_No=s.IME_No and s.OS LIKE 'Andriod%' and s.Network_3G="Y" and s.Camera_Quality="3.5MP";

25. "Write a Query to Display the unique mobile model name and manufacturer of the mobile which
has highest sales. <br/> Hint: Get the maximum count of mobile model from Sales info and get the
manufacturer using the mobile model. <br/><br/>For example, Nokia has three models M1, M2, M3
and Samsung has 2 models S1,S2. Assume M1 model has 5 sales, M2, 3, M3, 2 and S1, 3 and S2 2. If
that is the case the records to be displayed as M1 Nokia since it has the highest sales." Reply Reply to
all Forward

Select Model_Name,Manufacturer from mobile_master where IME_No IN (Select IME_No from


sales_info group by IME_No having count(IME_No)>=all(Select count(IME_No) from sales_info group by
IME_No));

You might also like