Posts

Showing posts from May, 2026

Callback Function Simple Explaination

Image
Callback Function A callback function is a function that you pass into another function , so it can be called later when something happens. Human example: You order food at a restaurant. You tell the waiter: “When my food is ready, call me.” Here, calling you later is like a callback. In programming: function cookFood(callback) { console.log("Cooking food..."); callback(); } function tellCustomer() { console.log("Your food is ready!"); } cookFood(tellCustomer); Output: Cooking food... Your food is ready! Here, tellCustomer is the callback function. Because we pass it into cookFood(tellCustomer) . Then cookFood runs it later using callback(); Another common example: setTimeout(function () { console.log("This runs after 2 seconds"); }, 2000); Here, the function inside set...

DAY 01 - SQL QUERIES

  Question You have a table called orders: orders(order_id, user_id, amount, order_date) Write an SQL query to find all users who have placed at least one order greater than the average order amount. Answer SELECT user_id FROM orders WHERE amount > (     SELECT AVG(amount)     FROM orders ); To avoid duplicate users: SELECT DISTINCT user_id FROM orders WHERE amount > (     SELECT AVG(amount)     FROM orders ); Explanation: Inner query calculates the average order amount first, then the outer query finds users with orders above that average.

How to setup laravel app without installing composer and php

 refer this url https://chatgpt.com/share/69f82535-54a0-83a2-96e6-3356b5110bd7 Docker first laravel setup