SQL_Server_Practical_Questions
SQL_Server_Practical_Questions
1. SQL Basics
1. Write a query to create a table with columns for ID, Name, and Salary.
2. Joins
1. Write a query to perform an INNER JOIN between two tables.
5. Write a query to perform a SELF JOIN to compare rows within the same table.
10. Fetch employees along with department details, handling nulls gracefully.
3. Stored Procedures
1. Create a stored procedure to retrieve employee details by Department.
7. Write a procedure to fetch employees with a Salary greater than a given value.
9. Write a procedure to log changes made to employee details into a log table.
4. Functions
1. Create a scalar function to calculate the age of an employee based on their DateOfBirth.
5. Indexes
1. Create a clustered index on the EmployeeID column.