1) Hierarchical Query using a Recursive CTE
The basic syntax structure for a CTE is shown below:
WITH MyCTE AS
(SELECT EmpID, FirstName, LastName,ManagerID
FROM Employee
WHERE ManagerID IS NULL )
SELECT *FROM MyCTE
Using C#.Net
The basic syntax structure for a CTE is shown below:
WITH MyCTE AS
(SELECT EmpID, FirstName, LastName,ManagerID
FROM Employee
WHERE ManagerID IS NULL )
SELECT *FROM MyCTE
Building a Recursive CTE
WITH MyCTE AS
(
SELECT EmpID, FirstName, LastName, ManagerID FROM Employee
WHERE ManagerID IS NULL
UNION ALL
SELECT EmpID, FirstName, LastName, ManagerID
FROM Employee
INNER JOIN MyCTE ON Employee.ManagerID = MyCTE.EmpID WHERE Employee.ManagerID IS NOT NULL
)
SELECT *FROM MyCTE
Using C#.Net
IList<Employee> GetEmployees(Employee manager)
{
var result = new List<Employee>();
var employees = _employeeDb.Employees
.Where(e => e.ManagerEmployeeNumber == manager.EmployeeNumber)
.ToList();
foreach (var employee in employees)
{
result.Add(employee);
result.AddRange(GetEmployees(employee));
}
return result;
}
2) What is SOLID?
SOLID are five basic principles whichhelp to create good software architecture. SOLID is an acronym where:-
- S stands for SRP (Single responsibility principle
- O stands for OCP (Open closed principle)
- L stands for LSP (Liskov substitution principle)
- I stands for ISP ( Interface segregation principle)
- D stands for DIP ( Dependency inversion principle)
- S stands for SRP (Single responsibility principle):- A class should take care of only one responsibility.
- O stands for OCP (Open closed principle):- Extension should be preferred over modification.
- L stands for LSP (Liskov substitution principle):- A parent class object should be able to refer child objects seamlessly during runtime polymorphism.
- I stands for ISP (Interface segregation principle):- Client should not be forced to use a interface if it does not need it.
- D stands for DIP (Dependency inversion principle) :- High level modules should not depend on low level modules but should depend on abstraction.
2)
HTTP | HTTPS |
URL begins with “http://” | URL begins with “https://” |
It uses port 80 for communication | It uses port 443 for communication |
Unsecured | Secured |
Operates at Application Layer | Operates at Transport Layer |
No encryption | Encryption is present |
No certificates required | Certificates require |
Thank you Jeffy.
ReplyDelete