 Now it may so happen that you are extracting data or retrieving data from multiple tables and you need to construct your result from multiple tables one after the other. MySQL provides a very powerful feature which is the union and you can use the union clause to achieve what I just mentioned. This module will briefly cover the union and as I have been mentioning with reference to the modules about code, you need to actually sit and type the code and run it. It's not complicated. It's very simple but it will give you a good understanding. Let's go ahead. So we'll talk about the simple union. Okay. Then the properties of union we'll be talking about with reference to the names and data types, duplicate elimination also because it ends sorting on union limit and nesting. There are certain properties of the union vis-a-vis which column was selected in the first table, which columns in the second table and so on. And this is going to become clear as we go and proceed with the examples. Let's move ahead. For the following examples, assume you have the three tables T1, T2 and T3. These are the tables we have T1, T2 and T3. Table T1 and T2 have integer and vector columns and T3 has date and integer columns. This is the date and this is the integer. To write a union statement that combines multiple retrievals, just write several select statements and put the keyword union between them. For example, to select the integer column from each table, we do this. We have this union over here and then union over here and this is the union from these tables and this is the answer. Okay. This is fairly simple. Let's look at more complicated with names and data type. Look at the properties. The names and data types for the columns of the union result come from the names and types of the columns in the first select. First select. The second and subsequent select statements in the union must select the same number of columns but they need not have the same names or types. Okay. You see over here we have integer and corrector and we have integer and date over here. We have corrector over here. Corrector. They are not same. Okay. Columns are matched by position, not by name, which is why these two queries return different results. Now I'll show you the queries also. In both cases, the column selected from T1, INC determine the types used in the union result. These columns have integer and string types. So the type conversion takes place when selecting values from T3. For the first query, this one over here. T is converted from date to string that happens to result in low loss of information. For the second query over here, T is converted from date to integer which does lose information. And I is converted from integer to string. All right. So you see we have what we have over here. Date versus integer and integer versus corrector over here. So these are the issues with the union you have to be careful about. Now duplicate elimination. So union has the following properties by default union eliminates duplicates rows from the result set. Okay. There are no duplicates. T1 and T2 both have a row containing values of one and red, but only one such row appears in the output. Also T3 has two rows containing the date 2004-01-01 and 201 of which has been eliminated. If you want to preserve duplicates, follow the first union keyword with all over here. So we have this, what we were trying to eliminate before over here, over here. These are the duplicates. Now how to perform sorting on the union? I'll show you. The sort a union result add an order by a clause after the last select. It applies to the query result as a whole. However, because a union uses column names from the first select the order by should refer to those names, not the column names from the last select. You can also specify an order clause for individual select statement within the union to do this. It includes the select including its order by within the parenthesis, which is shown over here. And limit can be used in a union in a manner similar to that for order by if added to the end of the statement, it applies to the union result as a whole, which is over here. If enclosed within parenthesis as part of an individual select statement, it applies only to that select. If you need not select from different tables, you can select different subsets of the same table using different conditions. This can be useful as an alternative to running several different select queries, because you get all the rows in a single result rather than as several result sets. So you see sorting on the union how it works. And it's a very powerful feature. That's all I have to discuss in this module. Thank you very much.