Friday, 28 March 2025

TodayInterview(EXL health interview)

1.update second table without using subquery.
2.SOLID
3.Abstract vs interface.

UPDATE es

SET es.Salary = es.Salary + 500,  -- Example: Increase salary

    es.Bonus = es.Bonus + 100     -- Example: Increase bonus

FROM EmpSalary es

INNER JOIN Emp e ON es.EmpID = e.EmpID

WHERE e.Department = 'IT';  -- Condition based on Emp table

CTE
WITH CTE_Update AS (
    SELECT es.EmpID, es.Salary, es.Bonus
    FROM EmpSalary es
    INNER JOIN Emp e ON es.EmpID = e.EmpID
    WHERE e.Department = 'IT'  -- Condition based on Emp table
)
UPDATE CTE_Update
SET Salary = Salary + 500,  -- Increase salary
    Bonus = Bonus + 100;    -- Increase bonus


using System;

using System.Linq;


public class HelloWorld

{

    public static void Main(string[] args)

    {

        var names = new string[] { "Alice", "Jonathan", "Christopher", "Bob", "Alexander" };


        var longestName = names

            .Select(name => new { Name = name, Length = name.Length })

            .OrderByDescending(x => x.Length)

            .First();


        Console.WriteLine($"Longest Name: {longestName.Name}");

        Console.WriteLine($"Length: {longestName.Length}");

        

    }

}

No comments:

Post a Comment

7 Common mistakes in Dot Net — You can avoid

  There are many common mistakes made during .NET (ASP.NET, .NET Core) development, which affect performance, security, and code… Code Crack...