SQL Server beginner interview questions and answers
Begineer Interview Q&A
How to generate a random string of 10 character?
There are many ways to generate a random string. This one is a simple way to do it.
How to generate a random number?
Generate a random number from 0 through 1, exclusive.
Generate a random number between 0 and 100.
Generate a random number between 1 and 100
Generate a random number between 10 and 30
COUNT(*) vs COUNT(1) vs SUM(1)
What is the output of the below queries when table is empty and non-empty?
When the table is empty:
When the table is non-empty:
How to select all the even number records from a table?
There is a table participant
which has more than 10k records and you need to select all the records with id in even number (i.e. 2,4,6,8 etc)
How to select all the odd number records from a table?
There is a table participant
which has more than 10k records and you need to select all the records with id in odd number (i.e. 1,3,5,7 etc)
How to select all the records from the table except the id’s which are divisible by 3?
There is a table participant
which has more than 10k records and you need to select all the records from the table except id in 3,6,9, etc