SQL GROUP BY Clause in SQL

Posted in DATABASES, SQL SERVERTagged

The SQL GROUP BY Clause is used along with the group functions to retrieve data grouped according to one or more columns. For Example: If you want to know the total order received  by date then use group by: SELECT CreatedOnUtc AS [ORDER DATE],COUNT(*) AS [TOTAL ORDER] FROM [Order] GROUP BY CreatedOnUtc   NOTE: The….

Difference between truncate and delete in sql

TRUNCATE When you TRUNCATE a table less information is logged.  This means the TRUNCATE statement executes very fast; however, it does so at the expense of not logging each row deleted. This means, that you need to be very careful when using the command (actually be careful with DELETE as well!). Truncate Syntax TRUNCATE TABLE UserMaster Truncate….

Join in SQl

SQL Join is used to get data from two or more tables, and show record in single set of data. SQL Join is used for combining column from two or more tables by using values common to both tables. Join Keyword is used in SQL queries for joining two or more tables. Minimum required condition for….

Difference between firstordefault and singleordefault

Both are the element operators and they are used to select a single element from a sequence. But there is a minor difference between them. SingleOrDefault() operator would throw an exception if more than one elements are satisfied the condition where as FirstOrDefault() will not throw any exception for the same Single() – There is….

Join Query using Entity FrameWork

I am explaining how to use join in entity framework. Example: var data= (from emp in dbContext.Employee join sal in dbContext.Salary on emp.EmployeeID equals sal.EmployeeID select new { EmployeeID= emp.EmployeeID, Name= emp.Name, Salary= sal.Salary }).ToList();

Cusror in SQL

Cursor is a Database object which allows us to process each row and manipulate its data. A Cursor is always associated with a Select Query and it will process each row returned by the Select Query one by one. Using Cursor we can verify each row data, modify it or perform calculations which are not….

Difference between function and procedure in sql

Functions and stored procedures are set of SQL statements that can be called by name. They have many similarities like they take arguments, used to perform required tasks and have same programming style and structure. But we are more interested in differences to grab the knowledge about power they held against each other. So here….

What is Generics in C#

Generics enable you to delay the specification of the info form of programming parts during a category or a way, till it’s really utilized in the program. In different words, generics enable you to put in writing a category or technique that may work with any information sort. You write the specifications for the category….

What is Delegates in C#

C# delegates are similar to pointers to functions, in C or C++. A delegate is a reference type variable that holds the reference to a method. The reference can be changed at runtime. A delegate declaration defines a type that encapsulates a method with a particular set of arguments and return type. For static methods,….

What is indexer in c#

In c# introduce new concept is Indexer. This is very useful for some situation. Let as discuss something about Indexer. Indexer Concept is object act as an array. Indexer an object to be indexed in the same way as an array. Indexer modifier can be private, public, protected or internal. The return type can be….