Vous êtes sur la page 1sur 2

UNION

The UNION command is used to select related information from two tables, much li
ke the JOIN command. However, when using
the UNION command all selected columns need to be of the same data type. With U
NION, only distinct values are selected.
UNION ALL
The UNION ALL command is equal to the UNION command, except that UNION ALL selec
ts all values.
The difference between Union and Union all is that Union all will not eliminate
duplicate rows, instead it just pulls all rows from all tables fitting your quer
y specifics and combines them into a table.
A UNION statement effectively does a SELECT DISTINCT on the results set. If you
know that all the records returned are unique from your union, use UNION ALL ins
tead, it gives faster results.
Example:
Table 1 : First,Second,Third,Fourth,Fifth
Table 2 : First,Second,Fifth,Sixth
Result Set:
UNION: First,Second,Third,Fourth,Fifth,Sixth (This will remove duplicate values)
UNION ALL: First,First,Second,Second,Third,Fourth,Fifth,Fifth,Sixth,Sixth (This
will repeat values)
Serialization is a process by which we can save the state of the object by conve
rting the object in to stream of bytes.
These bytes can then be stored in database, files, memory etc.
Different types of serialization.
The different types of serialization are
Binary Serialization
XML Serialization
SOAP Serialization
Binary Serialization
Binary serialization is the process where you convert your .NET objects into byt
e stream. In binary serialization all the
public, private, even those which are read only, members are serialized and con
verted into bytes. So when you want a
complete conversion of your objects to bytes then one can make use of binary se
rialization.
XML Serialization
In XML serialization only the public properties and fields of the objects are co
nverted into XML. The private members
are not taken into consideration in XML serialization.
SOAP Serialization
Similar to XML serialization. When you serialize object to SOAP format it confor
ms to the SOAP specification.
Need of Serialization
Most uses of serialization fall into two categories: persistence and data interc
hange. Persistence allows us to store
the information on some non-volatile mechanism for future use. This includes mu
ltiple uses of our application, archiving,
and so on. Data interchange is a bit more versatile in its uses. If our applica
tion takes the form of an N-tier solution
, it will need to transfer information from client to server, likely using a net
work protocol such as TCP. To achieve this
we would serialize the data structure into a series of bytes that we can transf
er over the network. Another use of
serialization for data interchange is the use of XML serialization to allow our
application to share data with another
application altogether.
As you can see, serialization is a part of many different solutions within our
application.

Vous aimerez peut-être aussi