Download Sindh Public Service Commission Lecturer Education Question Paper - March 2021
Developers Online - Programming Solutions
Learn Web Design & Development with programmingcovers blog tutorials. Angular, C#, SQL, CSS3, JavaScript, Responsive Web Design.
Friday, 19 March 2021
Monday, 19 October 2020
EFSOFT OMR Answer Sheet Reader [Specially for Coaching Centers and Schools]
EFSOFT OMR Software
EFSOFT OMR Software Key Features
1. It helps to check and assess the OMR sheet by comparing the student’s answers with the answer key for accurate results.
2. It can evaluate multiple sheets simultaneously with full automation. It has the capacity to process and assess a total of hundred sheets within just a minute.
3. The software can be used for processing the competitive exam answer sheet with black and white print.
4. Export Results as per your requirements in Excel or PDF.
Call or Whatsapp for Demo : +92 314 2615105
Email : tehseeninter@yahoo.com
Thursday, 24 September 2020
Wednesday, 23 September 2020
Wednesday, 12 June 2019
SQL Server - UNION, UNION ALL, INTERSECT
Remember Set Theory?
Part of the foundation of database theory is founded on set theory. If you are in your fifties or older you will remember set theory as the "new math." There is quite an irony in the moniker "new math" as set theory was written formally written about back in the 1870's.
It is also ironic that one needs to seldom write a union in SQL. In my twenty years of working in SQL, apart from teaching I have had to write a union once. For whatever reason giving problems in job interviews that require you to write a union seems to be quite popular. Yet I digress...
A Simple Example
Assume the following tables:
UNIONTABLE1
uniontable1
UNIONTABLE2
uniontable2
These are seperate SQL tables that just so happen to have the same schema. More on the requirements for a union in SQL Server later. For now lets look at the two tables in terms of set theory diagram.
set
You can see the overlapping data (for the language column). And, you can see where this column has unique data for each table.
UNION
If we want to combine the two tables and produce a recordset of all the unique rows found in each table we can create a UNION query.
SELECT language
,type
FROM Play.dbo.UNIONTABLE1
UNION
SELECT language
,type
FROM Play.dbo.UNIONTABLE2
The following are the results of the above union.
union
SQL Server Requirements for a UNION
The number and order of the columns must be the same in both queries. (Yes, it is possible to perform a union on more than two queries)
The data types must be compatible.
UNION ALL
We can return all the rows from both side in our union by adding the "ALL" keyword. In the query below I have added an "Order By" so you can more easily see the duplicates.
SELECT language
,type
FROM Play.dbo.UNIONTABLE1
UNION ALL
SELECT language
,type
FROM Play.dbo.UNIONTABLE2
ORDER BY language
The following are the results of the above union.
unionall
INTERSECT
If all we want to see are the duplicates between the two tables we can perform an INTERSECT instead of a UNION.
SELECT language
,type
FROM Play.dbo.UNIONTABLE1
INTERSECT
SELECT language
,type
FROM Play.dbo.UNIONTABLE2
The following are the results of the above intersect.
intersect
Subscribe to:
Posts (Atom)