Shorthand way to return values that might be null
Problem: Suppose we have get-only property as below. In this we have a private variable and a public property both are list type. privateList<User> _usr ; publicList<User> lst...
View ArticleHow to get absolute value in MongoDB
To get absolute value we can use $abs operator. $abs is the arithmetic aggregate operator which returns absolute value of number.Absolute value means it always returns positive value while number may...
View ArticleQuery to subtract in MongoDB
We can use $subtract operator to subtract tow numbers. $subtract is arithmetic aggregation operator which subtract two number and returns the difference. $subtract can be use to get differences between...
View ArticleOrder by with dynamic columns in LINQ c#
Hi Guys, sometimes we need to sort the data dynamically with dynamic column, suppose we are sowing data in grid and after click on column data should be sort, on first click it should be descending and...
View ArticleHow can we identify used space in log file?
Many times we face this question in interview “How can we identify used space in log file”. Using following DBCC command you can identify the used space in log file.DBCCSQLPERF('LOGSPACE')Result:You...
View ArticleInsert multiple rows in single SQL Query
There are many different way you can insert multiple rows in single SQL Query.When I was fresher, many times I face this question in interview, can you please write a script which can insert multiple...
View ArticleInterview Question and answer - SQL Server Day 1
Question: What is Stored Procedure?Answer: Stored Procedure is the collection of Structured Query Language (SQL) statements with an assigned name which stored in database in compiled form. Store...
View ArticleInterview Questions and answers - SQL Server Day 2
Question: What is an index in SQL Server?Answer: Index is responsible to arrange data physically to speed up the query performance. Index is the physical structure containing to the pointers of the...
View ArticleInterview Questions and answers - SQL Server Day 3
Question: What is difference between Function and Stored Procedure in SQL Server?Answer:Some basic difference between stored procedure and function is described below.The main difference between stored...
View ArticleInterview Questions and answers - SQL Server Day 4
Question: What is Primary and foreign key in SQL server?Answer: Primary key ensures the row have unique identity. Primary key have unique values and but can’t be null. A table can have only one primary...
View ArticleInterview Questions and answers - SQL Server Day 5
Question: What is difference between Truncate and Delete in SQL Server?Answer: If you wish to removes rows basis on condition then we have to use DELETE command while truncate will remove all the rows...
View ArticleInterview Questions and answers - SQL Server Day 6
Question: When we used UPDATE_STATISTICS commands in SQL server?Answer: When bulk changes done in your data base like INSERT, UPDATE and DELETE because bulk changes may increase your index view...
View ArticleInterview Questions and answers - SQL Server Day 7
Question: What are ACID properties in SQL Server?Answer: The ACID rules of transaction in any database ensure the reliability of data in all transactions in the database.AtomicityAtomicity shows the...
View ArticleInterview Questions and answers - SQL Server Day 8
Question: What is schema in SQL Server? How can we create schema in SQL Server?Answer: Schema introduced in SQL Server 2005 which is used for separation, Management and Ownership of database object....
View ArticleInterview Questions and answers - SQL Server Day 9
Question: What is the difference between char, nchar, varchar, and nvarchar in SQL Server?Answer: nchar and nvarchar can store Unicode characters. char and varchar cannot store Unicode characters.char...
View ArticleHow to get all tables which have primary key in SQL Server?
Some time we need to get all tables which have primary key constraints. There are many way to get this information.Select ISTC.Table_CatalogasBD_Name, ISTC.Table_SchemaASTBL_SCHEMA,...
View ArticleHow to get all tables without primary key in SQL Server?
There are many way to find tables without primary key one of them described below.Select Table_CataLogasDB_NAME, Table_SchemaasTBL_SCHEMA, Table_NameasTBL_NAME from...
View ArticleInterview Questions and answers - SQL Server Day 10
Question: Can we sort a column using a column alias in SQL Server?Answer: Yes, we can sort a column using a column alias in SQL Server.Example: Execute following queryCREATETABLE#TEMP(...
View ArticleIf parameter is null then select all data in SQL Server Query
We have a scenario, suppose we have a table like belowCREATETABLEEMP( FNAMEVARCHAR(100) ,LNAMEVARCHAR(100)...
View ArticleInterview Questions and answers for beginners - SQL Server Day 11
Question: What is SQL?Answer: SQL stands for Structured Query Language, which is use to retrieve, store and manipulate data in database.Question: What is data?Answer: In simple terms, the data can be...
View Article