SQL Questions:Loan Management system


Loan Management system





1.Write a query to display category and number of items in that category. Give the count an alias name of Count_category.
Display the details on the sorted order of count in descending order.

SELECT  item_category , count(item_id) Count_category
FROM item_master
GROUP BY item_category order by count_category DESC


2.Write a query to display the number of employees in HR department. Give the alias name as No_of_Employees.

SELECT count(employee_id) AS No_of_Employees
FROM employee_master
WHERE department= 'HR'


3.Write a query to display employee id, employee name,
designation and department for employees who have never been issued an item as a loan from the company.
 Display the records sorted in ascending order based on employee id.

SELECT employee_id, employee_name, designation, department
FROM employee_master WHERE employee_id
NOT IN ( SELECTemployee_id FROM employee_issue_details)
order by employee_id;


4.Write a query to display the employee id, employee name who was issued an item of highest valuation.
<br> In case of multiple records, display the records sorted in ascending order based on employee id.

[Hint Suppose an item called dinning table is of 22000 and that is the highest price of the item that has been issued. So display the employee id and employee name who issued dinning table whose price is 22000.]

SELECT eid.employee_id, employee_name
FROM employee_masterem INNER JOIN employee_issue_detailseid
ON em.employee_id=eid.employee_id
INNER JOIN item_masterim
ON eid.item_id=im.item_id
WHERE item_valuation=(SELECT max(item_valuation)
FROM employee_issue_detailseid INNER JOIN item_masterim
ON eid.item_id=im.item_id) order by eid.employee_id;


5.Write a query to display issue_id, employee_id, employee_name.
Display the records sorted in ascending order based on issue id.

SELECT issue_id, eid.employee_id, employee_name
FROM employee_masterem INNER JOIN  employee_issue_detailseid
ON em.employee_id=eid.employee_id order by issue_id;


6.Write a query to display employee id, employee name who don’t have loan cards.
Display the records sorted in ascending order based on employee id.

SELECT employee_id, employee_name
FROM employee_master
WHERE employee_id NOT IN ( SELECTemployee_id FROM employee_card_details )
order by employee_id;


7.Write a query to count the number of cards issued to an employee “Ram”.  Give the count an alias name as No_of_Cards.

SELECT count(loan_id)  AS No_of_Cards
FROM  employee_card_details c
JOIN  employee_master e
ON    c.employee_id = e.employee_id
WHERE e.employee_name= 'Ram'
GROUP BY c.employee_id


8.Write a query to display the count of customers who have gone for loan type stationary. Give the count an alias name as Count_stationary.

SELECT count(employee_id)  Count_stationary
FROM  employee_card_detailsecd INNER JOIN  loan_card_masterlcd
ON ecd.loan_id=lcd.loan_id
WHERE  loan_type='stationary'


9.Write a query to display the employee id, employee name   and number of items issued to them.
Give the number of items an alias name as Count.
 Display the details in descending order of count and then by employee id in ascending order.
 Consider only employees who have been issued atleast 1 item.

SELECT eid.employee_id, employee_name, count(item_id) Count
FROM  employee_masterem INNER JOIN employee_issue_detailseid
ON em.employee_id=eid.employee_id
GROUP BY employee_id order by count DESC, eid.employee_id;


10.Write a query to display the employee id, employee name who was issued an item of minimum valuation.

In case of multiple records, display them sorted in ascending order based on employee id.

[Hint Suppose an item called pen is of rupees 20 and that is the lowest price. So display the employee id and employee name who issued pen where the valuation is 20.]

SELECT eid.employee_id, employee_name
FROM employee_masterem INNER JOIN employee_issue_detailseid
ON em.employee_id=eid.employee_id
INNER JOIN item_masterim
ON eid.item_id=im.item_id
WHERE item_valuation=(SELECT min(item_valuation)
FROM employee_issue_detailseid INNER JOIN item_masterim
ON eid.item_id=im.item_id)
order by eid.employee_id;

11.Write a query to display the employee id, employee name and total valuation of the product issued to each employee.  Give the alias name as TOTAL_VALUATION.

Display the records sorted in ascending order based on employee id.

Consider only employees who have been issued atleast 1 item.

SELECT em.employee_id, employee_name, sum(item_valuation) TOTAL_VALUATION
FROM employee_masteremINNER  JOINemployee_issue_detailseid
ON em.employee_id=eid.employee_id
INNER JOIN item_masterim
ON eid.item_id=im.item_id
GROUP BY eid.employee_id
ORDER BY eid.employee_id;


12.Write a query to display distinct employee id, employee name who kept the item issued for more than a year. Hint: Use Date time function to calculate the difference between item issue and return date. Display the records only if it is more than 365 Days.

Display the records sorted in ascending order based on employee id.

SELECT DISTINCT eid.employee_id,employee_name
FROM  employee_issue_detailseid JOIN employee_masterem
ON eid.employee_id=em.employee_id
WHERE datediff(return_date,issue_date) >  365
order by eid.employee_id;


13.Write a query to display employee id,
employee name and count of items of those who asked for more than 1 furniture. Give the alias name for count of items as COUNT_ITEMS.

Display the records sorted in ascending order on employee id.

SELECT eid.employee_id, employee_name, count(eid.item_id) COUNT_ITEMS
FROM employee_issue_detailseid JOIN item_masterim
ON eid.item_id=im.item_id
JOIN employee_masterem
ON eid.employee_id=em.employee_id
WHERE item_category='furniture'
GROUP BY employee_id
HAVING COUNT_ITEMS>1
order by eid.employee_id;



14.Write a query to display the number of men & women Employees.
 The query should display the gender and number of Employees as No_of_Employees. Display the records sorted in ascending order based on gender.

SELECT gender , count(gender) No_of_Employees
FROM employee_master
GROUP BY gender ORDER BY gender

15.Write a query to display employee id, employee name who joined the company after 2005. Display the records sorted in ascending order based on employee id.

SELECT employee_id, employee_name
FROM employee_master
WHERE extract(year from date_of_joining)>2005
order by employee_id;


16.Write a query to get the number of items of the furniture category issued and not issued.
 The query should display issue status and the number of furniture as No_of_Furnitures.
Display the records sorted in ascending order based on issue_status.

SELECT  issue_status, count(item_id) No_of_Furnitures
FROM item_master
WHERE  item_category='Furniture'
GROUP BY issue_status
ORDER BY issue_status


17.Write a query to find the number of items in each category, make and description.
 The Query should display Item Category, Make, description and the number of items as No_of_Items.
 Display the records in ascending order based on Item Category, then by item make and then by item description.

SELECT item_category, item_make,item_description, count(item_description) No_of_Items FROM item_master
GROUP BY item_category, item_make, item_description ORDER BY item_category, item_make,item_description;


18.Write a query to display employee id, employee name,
item id and item description of employees who were issued item(s) in the month of January 2013.
 Display the records sorted in order based on employee id and then by item id in ascending order.

SELECT  eid.employee_id, employee_name, eid.item_id, item_description
FROM employee_issue_detailseid JOIN employee_masterem
ON eid.employee_id=em.employee_id
JOIN item_masterim
ON eid.item_id=im.item_id
WHERE extract(month from issue_date)=1 and extract(year from issue_date)=2013
ORDER BY eid.employee_id, eid.item_id;


19.Write a query to display the employee id, employee name and count of item category of the employees who have been issued items in at least 2 different categories.
Give the alias name for category count as COUNT_CATEGORY.
Display the records sorted in ascending order based on employee id.

SELECT em.employee_id,employee_name, count(distinct item_category) COUNT_CATEGORY
 FROM employee_issue_detailseid JOIN item_masterim
ON eid.item_id=im.item_id
JOIN employee_masterem
ON eid.employee_id=em.employee_id
GROUP BY employee_id
HAVING COUNT_CATEGORY>=2
ORDER BY employee_id;

20.Write a query to display the item id , item description which was never issued to any employee. Display the records sorted in ascending order based on item id.

SELECT item_id, item_description
FROM item_master
WHERE item_id
NOT IN ( SELECTitem_id from employee_issue_details)
ORDER BY item_id;


21.Write a query to display the employee id, employee name and&nbsp;&nbsp;totalvaluation&nbsp;for the employees who has issued minimum total valuation of the product.  Give the alias name for total valuation as TOTAL_VALUATION.

[Hint: Suppose an employee E00019 issued item of price 5000, 10000, 12000 and E00020 issue item of price 2000, 7000 and 1000. So the valuation of items taken by E00019 is 27000 and for E00020 it is 10000. So the employee id, employee name of E00020 should be displayed. ]

select employee_issue_details.employee_id,employee_master.employee_name,sum(item_master.item_valuation)as TOTAL_VALUATION from
employee_issue_details inner join item_master
onitem_master.item_id = employee_issue_details.item_id
inner join employee_master
onemployee_master.employee_id=employee_issue_details.employee_id
group by employee_issue_details.employee_id
order by TOTAL_VALUATION asc limit 1;


22.Write a query to display the employee id, employee name, card issue date and card valid date.
Order by employee name and then by card valid date. Give the alias name to display the card valid date as CARD_VALID_DATE.

[Hint:  Validity in years for the loan card is given in loan_card_master table. Validity date is calculated by adding number of years in the loan card issue date.
If the duration of year is zero then display AS 'No Validity Date'. ]

SELECT ecd.employee_id,employee_name,
card_issue_date, CASE duration_in_years
WHEN 0 THEN 'No Validity Date'
ELSE DATE_ADD(card_issue_date, INTERVAL duration_in_years YEAR)
END CARD_VALID_DATE
FROM employee_masterem INNER JOIN
employee_card_detailsecd
ON em.employee_id=ecd.employee_id
INNER JOIN loan_card_masterlcd
ON ecd.loan_id=lcd.loan_id
order by employee_name,  CARD_VALID_DATE;
Please follow instructions given below.


23.Write a query to display the employee id, employee name who have not issued with any item  in the year 2013.
 Hint: Exclude those employees who was never issued with any of the items in all the years. Display the records sorted in ascending order based on employee id.

SELECT DISTINCT a.employee_id,b.employee_name FROM employee_issue_details a JOIN
employee_master b ON a.employee_id=b.employee_id WHERE a.employee_id NOT IN(SELECT employee_id
FROM employee_issue_details WHERE (EXTRACT(YEAR FROM issue_date)=2013))
ORDER BY a.employee_id;

Please follow instructions given below.


24.Write a query to display issue id, employee id, employee name, item id, item description and issue date.
Display the data in descending order of date and then by issue id in ascending order.

SELECT issue_id, eid.employee_id, employee_name, im.item_id, item_description,issue_date
FROM employee_issue_detailseid INNER JOIN employee_masterem
ON eid.employee_id=em.employee_id
INNER JOIN item_masterim
ON eid.item_id=im.item_id
ORDER BY issue_datedesc, issue_idasc;



25.Write a query to display the employee id, employee name and total valuation for employee who has issued maximum total valuation of the product.&nbsp;
Give the alias name for total valuation as TOTAL_VALUATION.&nbsp;
<br>[Hint: Suppose an employee E00019 issued item of price 5000, 10000, 12000 and E00020 issue item of price 2000, 7000, and 1000.
 So the valuation of items taken by E00019 is 27000 and for E00020 it is 10000. So the employee id, employee name and total valuation of E00019 should display. ]

select employee_issue_details.employee_id,employee_master.employee_name,sum(item_master.item_valuation)as TOTAL_VALUATION from
employee_issue_details inner join item_master
onitem_master.item_id = employee_issue_details.item_id
inner join employee_master
onemployee_master.employee_id=employee_issue_details.employee_id
group by employee_issue_details.employee_id
order by TOTAL_VALUATION desc limit 1;

SHARE
    Blogger Comment
    Facebook Comment

34 comments :

  1. Good everyone.
    My name Mrs, Jessica Phillips, i am from USA CA , i am married, i have been searching for a genuine loan company for the past 2 years and all i got was bunch of scams who made me to trust them and at the end of the day, the took all my money and left me Money less, all my hope was lost, i got confused and frustrated, i lost my job and find it very difficult to feed my family, i never wanted to do anything will loan companies on net anymore, so went to borrow some money from a friend, i told her all that happened and she said that she can help me, that she knows a loan company that can help me, that she just got a loan from them, he directed me on how to apply for the loan, i did as he told me, i applied, i never believed but i tried and to my surprise i got the loan in 24 hours, i could not believe my eyes, i am happy and rich today and i am thanking God that such loan companies like this still exist upon this fraud stars all over the places, please i advise everyone out there who are in need of loan to go for Mr. William Walker . Email via ; (believeloancompany@gmail.com). he did not know am doing this for him,but i just have to do it because a lost of people are out there who are in need for a loan., they will never fails, your life shall change as mine did.

    Thanks and Good Luck.


    ReplyDelete
    Replies
    1. Hello Everybody,
      My name is Ahmad Asnul Brunei, I contacted Mr Osman Loan Firm for a business loan amount of $250,000, Then i was told about the step of approving my requested loan amount, after taking the risk again because i was so much desperate of setting up a business to my greatest surprise, the loan amount was credited to my bank account within 24 banking hours without any stress of getting my loan. I was surprise because i was first fall a victim of scam! If you are interested of securing any loan amount & you are located in any country, I'll advise you can contact Mr Osman Loan Firm via email osmanloanserves@gmail.com

      LOAN APPLICATION INFORMATION FORM
      First name......
      Middle name.....
      2) Gender:.........
      3) Loan Amount Needed:.........
      4) Loan Duration:.........
      5) Country:.........
      6) Home Address:.........
      7) Mobile Number:.........
      8) Email address..........
      9) Monthly Income:.....................
      10) Occupation:...........................
      11)Which site did you here about us.....................
      Thanks and Best Regards.
      Derek Email osmanloanserves@gmail.com

      Delete
  2. Good everyone.
    My name Mrs, Jessica Phillips, i am from USA CA , i am married, i have been searching for a genuine loan company for the past 2 years and all i got was bunch of scams who made me to trust them and at the end of the day, the took all my money and left me Money less, all my hope was lost, i got confused and frustrated, i lost my job and find it very difficult to feed my family, i never wanted to do anything will loan companies on net anymore, so went to borrow some money from a friend, i told her all that happened and she said that she can help me, that she knows a loan company that can help me, that she just got a loan from them, he directed me on how to apply for the loan, i did as he told me, i applied, i never believed but i tried and to my surprise i got the loan in 24 hours, i could not believe my eyes, i am happy and rich today and i am thanking God that such loan companies like this still exist upon this fraud stars all over the places, please i advise everyone out there who are in need of loan to go for Mr. William Walker . Email via ; (believeloancompany@gmail.com). he did not know am doing this for him,but i just have to do it because a lost of people are out there who are in need for a loan., they will never fails, your life shall change as mine did.

    Thanks and Good Luck.


    ...

    ReplyDelete
  3. My Brothers and Sister all over the world, I am Mrs Boo Wheat from Canada ; i was in need of loan some month ago. i needed a loan to open my restaurant and bar, when one of my long time business partner introduce me to this good and trustful loan lender DR PURVA PIUS that help me out with a loan, and is interest rate is very low , thank God today. I am now a successful business woman, and I became useful. In the life of others, I now hold a restaurant and bar. And about 30 workers, thank GOD for my life I am leaving well today a happy father with three kids, thanks to you DR PURVA PIUS Now I can take care of my lovely family, i can now pay my bill. I am now the bread winner of my family. If you are look for a trustful and reliable loan leader. You can Email him via,mail (urgentloan22@gmail.com) Please tell him Mrs Boo Wheat from Canada introduce you to him. THANKS

    ReplyDelete
  4. Write a query to display employee_id, issue_id, item_make & item_category of items taken by the employees. Sort the records based on employee_id. (Hint: Retrieve records from Item_master,employee_issue_details) please help me

    ReplyDelete
  5. Thanks for your article later i had few doughts about this software
    "AllCloud loan management software uses cutting edge technology which automates the process for quick loan approval.
    "

    ReplyDelete
  6. Thanks for your article later i had few doughts about this software
    "AllCloud loan management software uses cutting edge technology which automates the process for quick loan approval.
    "

    ReplyDelete
  7. You are running a money lending business then loan management system is best app for you. We provide money lending software Development .

    ReplyDelete
  8. Thanks for sharing your views with us. You can enhance your money lending business with Money lending Software. We develops money lending software for you.

    ReplyDelete
  9. Thanks for sharing your views. you can make best loan management software with us. We develops world class apps for you in less cost.

    ReplyDelete
  10. Thanks for sharing your views.
    You can develop education loan management software, vehicle loan management software, personal loan management software with us. We develops user friendly apps for you.

    ReplyDelete
  11. Thanks for sharing your views
    Loan Management System Software can increase revenues of money lending business. You can do hassle free money lending business.

    ReplyDelete
  12. Very Nice article.. Thank you so much for sharing this article.
    Furniture Pack
    landlord furniture packs

    ReplyDelete
  13. I really really love it. It's so good and so awesome. I am just amazed. I hope that you continue to do your work like this in the future also.
    This is an awesome motivating article. tool bag singapore price

    ReplyDelete
  14. Do you need a quick long or short term loan with a relatively low interest rate as low as 3%? We offer new year loan, business loan, personal loan, home loan, auto loan,student loan, debt consolidation loan e.t.c. no matter your score, If yes contact us via email:financialoffer212@gmail.com

    ReplyDelete
  15. i am a private loan lender which have all take to be a genuine lender i give out the best loan to my client at a very convenient rate.The interest rate of this loan is 3%.i give out loan to public and private individuals.the maximum amount i give out in this loan is $1,000,000.00 USD why the minimum amount i give out is 5000.for more information contact us email financialoffer212@gmail.com

    Your Full Details:
    Full Name :………
    Country :………….
    state:………….
    Sex :………….
    Address............
    Tel :………….
    Occupation :……..
    Amount Required :…………
    Purpose of the Loan :……..
    Loan Duration :…………
    Phone Number :………
    Contact email:financialoffer212@gmail.com

    ReplyDelete
  16. Hello, Do you need a loan from The most trusted and reliable company
    in the world? if yes then contact us now for we offer loan to all
    categories of seekers be it companies or for staff usage. We offer
    loan at 3% interest rate, Contact us via Whats app
    financialoffer212@gmail.com

    LOAN SEEKERS APPLICATION FORM
    ******************************
    1) Full Name:
    2) Gender:
    3) Loan Amount Needed:
    4) Loan Duration:
    5) Country:
    6) Home Address:
    7) Mobile Number:
    8) Fax Number:
    9) Occupation:
    10) Monthly Income:
    11) Salary Date:
    12) Purpose of loan:
    13) Where did you get our loan advertisement:
    financialoffer212@gmail.com

    ReplyDelete
  17. It is always good to select the right policies which are essential. We and our Home Insurance Policy Texas team have found out many policies and important details which are all helpful. In the last few years our commitment and zeal to work for common people have increased.

    ReplyDelete
  18. There are countless new solutions which we are offering and it is through our portal that you will be getting the best solutions. Insurance selection is not an easy task; one has to go through all the Auto Insurance Policy Texas details before making the right choice. We and our team is making sure that you get the chance to find the best for your need. The best insurance schemes are available online and we are helping customers to know which the best plans for the need are.

    ReplyDelete
  19. Thank you so much to share such useful information and makes me more knowledgeable.
    Furniture packs
    Furniture Packages

    ReplyDelete
  20. Meesho Seller Services With 0% Commission, it permits small businesses and independent individuals to start an online business using social-media platforms without any investments.

    ReplyDelete
  21. Great information on loan management app. Everything was explained step-by-step in detail. Thanks for sharing such a great blog.

    ReplyDelete
  22. If you are looking for the Stepchange wales official contact number 03338803165 & address for debt related solution. Stepchange is option.

    Stepchange Wales Address

    ReplyDelete
  23. After reading your article i came to know about SQL Questions:Loan Management system.
    This is very unique and helpfull. I like it . Thanks
    Virtual office in Mumbai

    ReplyDelete
  24. This comment has been removed by the author.

    ReplyDelete
  25. This comment has been removed by the author.

    ReplyDelete
  26. Such a nice blog. keep sharing this kind of useful information. visit our website to know more about us. I hope this will be useful for you in some ways. https://member.blacklabelcrm.com/

    ReplyDelete
  27. I really liked your blog. I appreciate the work you have done. Keep it up like this. Thank you
    Explore Synthetic Leather By Responsive Industries.

    ReplyDelete
  28. Hello,

    Good post. It's always helpful to read through an article, your article provides such great information with good knowledge that surely can enrich my knowledge. the topic here I found was really effective

    A loan management system is a digital platform that helps automate every stage of the loan lifecycle, from application to closing. The traditional loan management process is meticulous, time-consuming, and requires collecting and verifying information about applicants, their trustworthiness, and their credibility.


    If you want to read about more benefits of Loan origination system. I read through an article and I think it will be helpful for your visitors.I want to share with you check out-


    Loan Management System



    Thank you keep posting



    ReplyDelete

loading...