What Is the Difference Between a Join and a UNION?

Posted in DATABASES, SQL SERVERTagged , ,

Joins and Unions can be used to join data from one or one more tables.  The difference lies in how the data is combined. In simple terms, joins combine data into new columns.  If two tables are joined together, then the data from the first table is shown in one set of column alongside the….

Validation in MVC

Validation is an important point in ASP.NET MVC applications. It is used to check whether the user input is valid. ASP.NET MVC provides a set of validation that is easy-to-use and at the same time, it is also a powerful way to check for errors and, if necessary, display messages to the user. Adding Validation….

What is Sub queries?

Posted in DATABASES, SQL SERVERTagged ,

SQL Sub queries are the queries which are set inside another query. The set queries are called as INNER query & container query is called as OUTER query. The subqueries are the queries which are executed inside of another query. The result SQL query is totally depends on the result of sub query. First the INNER….

SQL Create DataBase

SQL Create DataBase The CREATE DATABASE Statement is used to create a database in SQL. After creating a database, we can create some other database objects like  (tables, views, procedures etc.) into it. The user should have admin privileges for creating database.: SQL CREATE DATABASE Syntex: CREATE DATABASE database_name   CREATE DATABASE Example: If you….

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….