Posts

SQL Queries Code Interviews QA 50 plus

Image
Here are SQL-focused interview questions with only the relevant SQL code: 1. Find the second highest salary from an Employee table. SELECT MAX(Salary) AS SecondHighestSalary FROM Employees WHERE Salary < (SELECT MAX(Salary) FROM Employees); Using ROW_NUMBER(): WITH RankedSalaries AS (   SELECT Salary, ROW_NUMBER() OVER (ORDER BY Salary DESC) AS Rank   FROM Employees ) SELECT Salary AS SecondHighestSalary FROM RankedSalaries WHERE Rank = 2; --- 2. Write a query to calculate a running total of sales. SELECT   OrderID,   OrderDate,   Amount,   SUM(Amount) OVER (ORDER BY OrderDate) AS RunningTotal FROM Orders; --- 3. Retrieve customers who placed no orders using a LEFT JOIN. SELECT c.CustomerID, c.CustomerName FROM Customers c LEFT JOIN Orders o ON c.CustomerID = o.CustomerID WHERE o.OrderID IS NULL; --- 4. Write a query to find the top 3 highest salaries. SELECT DISTINCT Salary FROM Employees ORDER BY Salary DESC LIMIT 3; Using DENSE_RANK(): WIT...

Stock Market Real time dashboard in Google sheet

Image
Here’s the step-by-step process for creating a Google Sheets dashboard for real-time stock market data in a point-by-point format: --- Step 1: Setup the Google Sheet 1. Open a new Google Sheet. 2. Rename the sheet to something like "Stock Dashboard." --- Step 2: Enable Real-Time Data with GOOGLEFINANCE 1. Use the GOOGLEFINANCE function to fetch stock data. 2. Example formulas: Current Price: =GOOGLEFINANCE("TICKER_SYMBOL", "price") Opening Price: =GOOGLEFINANCE("TICKER_SYMBOL", "open") 52-Week High: =GOOGLEFINANCE("TICKER_SYMBOL", "high52") 52-Week Low: =GOOGLEFINANCE("TICKER_SYMBOL", "low52") Market Cap: =GOOGLEFINANCE("TICKER_SYMBOL", "marketcap") --- Step 3: Create Columns for Data 1. Add headers in Row 1: Stock Symbol Current Price Open Price 52W High 52W Low Market Cap 2. Enter stock symbols (e.g., "GOOG", "AAPL") in Column A. 3. Use the GOO...

Diversified Investment on Nifties & Fractional Ownership with diverse cities

Fractional Ownership  Investing ₹25 lakh in fractional ownership of commercial real estate across major Indian cities can yield varying returns based on rental yields and property appreciation rates. Here's a comparative analysis for Bangalore, Chennai, Mumbai, Delhi, Kolkata, Pune, and Hyderabad over a 10-year period: 1. Rental Yields and Property Appreciation Rates: Bangalore: Rental Yield: Approximately 7.75% per annum. Property Appreciation: Around 8% per annum.  Chennai: Rental Yield: Approximately 5.06% per annum. Property Appreciation: Around 6% per annum. Mumbai: Rental Yield: Approximately 7.75% per annum. Property Appreciation: Around 7% per annum.  Delhi: Rental Yield: Approximately 8% per annum. Property Appreciation: Around 6% per annum.  Kolkata: Rental Yield: Approximately 5.03% per annum. Property Appreciation: Around 5% per annum. Pune: Rental Yield: Approximately 4.35% per annum. Property Appreciation: Around 6% per annum.  Hyderabad: Rental Yi...