Tuesday, 30 July 2024

How do I find an organization’s employee hierarchy using SQL?

 Finding an organization's employee hierarchy using SQL typically involves working with a table that stores information about employees and their relationships within the organization. The table usually includes columns like `employee_id`, `manager_id`, and other relevant information. Here's a general approach using a common scenario:

Assuming you have a table named `employees` with the columns `employee_id` and `manager_id`, where `manager_id` refers to the `employee_id` of the manager:




;with RECURSIVEEmpH as

(

select e.EmployeeID,e.Name,e.ManagerID, 1 as depth from dbo.Employee e where e.ManagerID is null

union all

select e.EmployeeID,e.Name,e.ManagerID,eh.depth+1 from dbo.Employee e  join RECURSIVEEmpH eh on e.ManagerID=eh.EmployeeId

)

select * from RECURSIVEEmpH


EmployeeID Name ManagerID depth

1 Mike 3 2

2 David 3 2

3 Roger NULL 1

4 Marry 2 3

5 Joseph 2 3

7 Ben 2 3




Thursday, 25 July 2024

sql server interview questions 2024

 https://www.youtube.com/watch?v=bfDhm6tTXtU

c# interview questions 2024

 Q1. What are the main concepts of OOPS? What are classes and objects?

07:18 - Q2. What is Inheritance? Why Inheritance is important? 10:33 - Q3. What are the different types of Inheritance? 14:38 – Q4. How to prevent a class from being Inherited? 16:22 – Q5. What is Abstraction? 19:30 – Q6. What is Encapsulation? 23:52 – Q7. What is Polymorphism and what are its types? 26:47 – Q8. What is Method Overloading? In how many ways a method can be overloaded? 30:41 – Q9. What is the difference between Overloading and Overriding? 34:45 – Q10. What is the difference between Method Overriding and Method Hiding? 37:37 – Q11. What are the advantages and limitations of OOPS? 41:31 – Q12. What is the difference between an Abstract class and an Interface (atleast 4)? 46:45 – Q13. When to use Interface and when Abstract class? 50:39 – Q14. Why to even create Interfaces? 54:38 – Q15. Do Interface can have a Constructor? 56:17 – Q16. Can you create an instance of an Abstract class or an Interface? 58:54 - Q17. What are Access Specifiers? What is the default access modifier in a class? 03:47 – Q18. What is Boxing and Unboxing? 01:06:35 – Q19. What is the difference between “String” and “StringBuilder”? When to use what? 01:10:12- Q20. What are the basic string operations in C#? 01:12:56- Q21. What are Nullable types? 01:14:42 – Q22. Explain Generics in C#? When and why to use them? 01:20:18 – Q23. How to implement Exception Handling in C#? 01:24:05 – Q24. Can we execute multiple Catch blocks? 01:25:35 – Q25. What is a Finally block and give an example when to use it? 01:27:22 – Q26. Can we have only “Try” block without “Catch” block? 01:28:45 – Q27. What is the difference between “throw ex” and “throw”? 01:33:14 – Q28. What are the Loop types in C#? 01:37.04 – Q29. What is the difference between “continue” and “break” statement? 01:40:52 – Q30. What is the difference between Array and ArrayList (atleast 2)? 01:43:39 - Q31. What is the difference between Arraylist and Hashtable? 01:45:23 – Q32. What are Collections in C# and what are their types? 01:48:49 – Q33. What is IEnumerable in C#? 01:52:15 – Q34. What is the difference between IEnumerable and IEnumerator in C#? 01:55:06 – Q35. What is the difference between IEnumerable and IQueryable in C#? Why to use IQueryable in sql queries? 01:58:30 – Q36. What is the difference between “out” and “ref” parameters? 02:05:06 – Q37. What is the purpose of “params” keyword? 02:07:04 – Q38. What is a Constructor and what are its types? 02:17:59 – Q39. When to use Private constructor? 02:19:27 – Q40. What are Extension Methods in C#? When to use them? 02:24:53 – Q41. What you mean by Delegate? When to use them? 02:29:35 – Q42. What are Multicast Delegates? 02:34:23 – Q43. What are Anonymous Delegates in C#? 02:36:37 – Q44. What are the differences between Events and Delegates? 02:40:28 – Q45. What is “this” keyword in C#? When to use it? 02:44:09 – Q46. What is the purpose of “using” keyword in C#? 02:48:42 – Q47. What is the difference between “is” and “as” operators? 02:52:09 – Q48. What is the difference between “Readonly” and “Constant” variables (atleast 3)? 02:57:35 – Q49. What is “Static” class? When to use it? 03:00:26 – Q50. What is the difference between “var” and “dynamic” in C#? 03:03:17 – Q51. What is Enum keyword used for?

Q1. What are the advantages of OOPS? 02:47 - Q2. What are the limitations of OOPS? 03:32 - Q3. What are the different types of Inheritance? 06:45 - Q4. How to prevent a class from being Inherited? 07:36 - Q5. What is Polymorphism and what are its types? 08:12 - Q6. What is Method Overloading? In how many ways a method can be overloaded? 10:58 - Q7. What is the difference between Overloading and Overriding? 13:05 - Q8. What is the difference between an Abstract class and an Interface (atleast 4)? 15:23 - Q9. When to use Interface and when Abstract class? 18:59 - Q10. Why to even create Interfaces? 20:40 - Q11. Do Interface can have a Constructor? 21:05 - Q12. Can you create an instance of an Abstract class or an Interface? 21:29 - Q13. What is the difference between “out” and “ref” parameters? 25:27 - Q14. What is the purpose of “params” keyword? 26:28 - Q15. What are Access Specifiers? What is the default access modifier in a class? 29:11 - Q16. How to implement Exception Handling in C#? 30:16 - Q17. Can we execute multiple Catch blocks? 30:41 - Q18. What is a Finally block and give an example when to use it? 31:15 - Q19. Can we have only “Try” block without “Catch” block? 32:06 - Q20. What is the difference between “throw ex” and “throw”? 33:32 - Q21. What are the Loop types in C#? 35:20 - Q22. What is the difference between “continue” and “break” statement? 36:33 - Q23. What is the difference between Array and ArrayList (atleast 2)? 37:52 - Q24. What is the difference between Arraylist and Hashtable? 38:26 - Q25. What is “this” keyword in C#? When to use it? 40:06 - Q26. What is the purpose of “using” keyword in C#? 42:38 - Q27. What is the difference between “is” and “as” operators? 44:31 - Q28. What is the difference between “Readonly” and “Constant” variables (atleast 3)? 46:34 - Q29. What is Boxing and Unboxing? 47:50 - Q30. What is the difference between “String” and “StringBuilder”? When to use what? 50:16 - Q31. What are Nullable types? 51:21 - Q32. What are the important components of .NET framework? What are their roles? 54:22 - Q33. What is an Assembly? What are the different types of assembly in .NET? 56:41 - Q34. What is GAC? 57:04 - Q35. What is Garbage Collection(GC)? 58:44 - Q36. Can we force Garbage Collector to run? 59:26 - Q37. What is the difference between Process and Thread? 01:00:22 - Q38. Explain Multithreading? 01:01:40 - Q39. What is Reflection?

https://www.youtube.com/watch?v=Bai9_LSZfAI

.net core interview questions 2024

 What is .NET Core

01:15 - Advantages of .NET Core Over . Net Framework 03:06 - Explain default project structure ? 04:53 - Role of Program .CS file 05:47 - What is the role of Startup.cs file? 06:51 - What is the role of ConfigureServices & Configure method? 08:39 - What is Dependency Injection in ASP.NET Core? 12:56 - What are the types of Service Lifetimes of an object/ instance in ASP.NET Core?AddSingleton, AddSoped and AddTransient method? 15:31 - What is Middleware in ASP.NET Core? 16:44 - What is Kestrel? 17:50 - What is the difference between Kestrel and IIS? 18:47 - What is request Delegate ? 20:43- What is Host in ASP.NET Core ? 21:53 - What are the various techniques to save configuration settings in ASP.NET Core? 22:43 - How Routing Works? 23:27 - Explain Attribute Routing ? 24:21 - Complete Request processing pipeline? 24:56 - Can ASP.NET core application work with .NET 4.X Framework? 25:20 - What is metapackage ? 26:11 - How ASP.NET core serve static files ? 26:42 - Various JSON files ? 27:56 - .NET Standard ? 28:33 - Razor Pages ? 29:14 - Dependency Injection ? 30:19 - Custom Middleware ? 31:51 - Explain session and state management ? 33:17 - Explain model validation ? 33:59 - How to handle errors ? 35:17 - How to enable session ? 35:46 - Explain Model Binding ?

https://www.youtube.com/watch?v=5sUUWa4SiY4