Reset Identity column value
An identity column in table generates key values automatically based on the current seed and increment, and the benefit of creating an identity column is… Read More »Reset Identity column value
69 total views
A Series of SQL Server basics to advanced level SQL Interview questions and answers that are commonly asked in interivew.
An identity column in table generates key values automatically based on the current seed and increment, and the benefit of creating an identity column is… Read More »Reset Identity column value
69 total views
Write an SQL query to report the nth highest salary from the Employee table. If there is no nth highest salary, the query should report null. Table:… Read More »SQL Leet Code Nth Highest Salary Problem
336 total views
SQL Leet code problem: Rank Scores Write an SQL query to rank the scores. The ranking should be calculated according to the following rules: The… Read More »SQL Leet Code Rank Scores Problem
357 total views
You can convert multiple rows into a single comma separated row, it can done by multiple ways using inbuilt SQL functions. As you can see… Read More »How to get multiple row data in single row in SQL
3,884 total views, 5 views today
Rolling average is a calculation to analyze data by creating series of average of different subsets of the entire data. For example, you have data… Read More »Rolling average in SQL
1,781 total views, 2 views today
To find the highest salary of employee in each department, first we will create a sample tables named EmployeeDetails and Department as shown below. CREATE… Read More »How to get top salary of each department
4,992 total views
There are multiple ways to get the size of table in SQL Server. Lets take a look on them one by one. Using sp_spaceused system… Read More »How to get the size of table in SQL
5,372 total views
Sometimes you need to insert same row multiple times in a table. There are many ways to do that but here we will see one… Read More »Insert same rows multiple times in table
6,166 total views
In this article you will see how to compare column names in two table. Assume that, you have two tables and you are asked to… Read More »How to compare column names in two tables in SQL
10,974 total views, 3 views today
You may have faced a situation where you are asked to find values in a column with leading or trailing spaces or remove the leading… Read More »How to find leading and trailing spaces in SQL Server ?
4,459 total views
How to search for string within xml column in SQL table? As you can see here we have a sample table having categories and products… Read More »Search string in xml
2,740 total views
Sometimes, you need to show range of numbers or may be asked to generate a range of numbers between two numbers in SQL Server. Well,… Read More »Generate a range of numbers between two numbers in SQL Server
9,502 total views
Assume that you have a table which contains alphabetic, numeric, alphanumeric string, and special characters and you are asked to fetch only alphanumeric string from… Read More »How to fetch alphanumeric string from table
18,811 total views, 2 views today
SQL Server indexes are used by queries to find data values quickly in tables and views. Basically it speed up the queries performance. You can… Read More »Difference between clustered index and non clustered index
2,864 total views
SQL Server update statement is used used to modify an existing records in a table, you can also update records in table based on some… Read More »How to Update from Select Statement in SQL
3,506 total views
Sometimes, you need to store multi language or multilingual data in any table column. Inserting a multilingual data into column without following some basics rules,… Read More »Insert multi language data in table
5,152 total views
Sometimes, you want to store the result of a stored procedure into table or temp table instead of returning the output. Storing output of stored… Read More »How to insert the result of a stored procedure into table
32,163 total views, 2 views today
Sometimes you need to format a date in specific format such as format a date time string YYYY-MM-DD hh:mm:ss. mmm to date MM:DD:YY. SQL Server… Read More »Date and Time Conversions in SQL Server
3,830 total views
Sometime you are required to validate the row counts for each tables in database. So getting a row counts for each tables either through using… Read More »Get Row Counts for all tables in SQL Server
13,316 total views, 1 views today
There are various in-built system catalog views, or metadata functions that you can use to check the existence of column in SQL Server tables. To… Read More »Check if column Exists or not in SQL Server Table
46,320 total views, 3 views today