Tag: Query
Alias Names for Tables in SQL Query
There are times when you write query and end up qualifying the columns references by indicating the table name. For example , In the above query , the Department table is referred in the GroupName and Name column. Instead of mentioning the table table , we could provide a shortname or alias name for the table and use the alias name instead. The full use…
How to Get the Max Value from a List of Integer using LINQ Query in C#?
One of the easiest way to get the Max value from a List of Integer in C# is to use LINQ extension method. The LINQ in C# provide the Max method which can be used to retrieve the Max Value from the List. How to Get the Max Value from a List of Integer using LINQ Query in C#?
How to get specific columns from a Table in SQL Query ?
If you want to get the data from the specific columns from a table in your database , you can specify them in the query. For example, This would return the data of all the columns available in the Department table. If you want to get the data of the specific columns from the Department table , you can specify the column names in the…
Example of deferred execution of LINQ Query in C# .NET
Below is a sample code snippet that demonstrates the deferred execution of LINQ Query in C#. Example of deferred execution of LINQ Query in C# .NET The Output of the above program is
Using NOT operator to inverse the condition in SQL Server
Imagine a scenario where you want to retreive records that you dont want. You can use the NOT operator to reverse the search condition. For example , You want to get all the departments having the GroupName other than ‘Research and Development’. The other way of getting the same result is using the != in every condition.
How to Get the First Element from LINQ Query in C#?
Below is a sample source code demonstrating How to Get the First Element from LINQ Query in C#? How to Get the First Element from LINQ Query in C#?
Returning Dictionary from LINQ Query in C#
Below is a sample source code demonstrating how to return Dictionary of<int, string> from the LINQ Query result. Returning Dictionary from LINQ Query in C#