Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 06-11-2009
Member
 
Join Date: Nov 2009
Posts: 610
Using Internal and External union SQL Queries

The links between tables are made by combining INNER clause records from two tables whenever there are matching values in common. If this is proper then what is the syntax used here for this. What syntax should I apply of getting Internal union and external on the same hand with other tables. The UNION operation is used to creating a union query, combining two or more separate tables or queries. Thanks in advance.
Reply With Quote
  #2  
Old 06-11-2009
Member
 
Join Date: Jan 2008
Posts: 1,515
Re: Usiing Internal and External union SQL Queries

You are correct that UNION operation is used to create a union query, by combining the results of two or more separate tables or queries. Its syntax is: [TABLE] query1 UNION [ALL] [TABLE] query2 [UNION [ALL] [TABLE] consulting [... ]]. The explanation for the syntax is query 1, query 2 with n is for SELECT statements are the name of a stored query or a stored table name preceded by the keyword TABLE. You can combine the results of two or more queries, tables, and SELECT statements, in any order, in a single UNION operation.
Reply With Quote
  #3  
Old 06-11-2009
Member
 
Join Date: Apr 2008
Posts: 1,948
Re: Usiing Internal and External union SQL Queries

If you not stating then there will be no duplicate records are returned when using the UNION operation, however it can include the ALL predicate to ensure that all records are returned. This makes the query run faster. All the queries which lies in a UNION operation must ask for the same number of fields, however the fields need not be the same size or the same type of data. The GROUP BY clause and / or HAVING in each query argument to group the returned data. Also ORDER BY can be used to get the clause at the end of the last query argument to display the data returned in a specific order.
Reply With Quote
  #4  
Old 06-11-2009
Member
 
Join Date: May 2008
Posts: 2,008
Re: Usiing Internal and External union SQL Queries

The syntax for internal union is SELECT fields FROM tb1 INNER JOIN TB2 ON
tb1.campo1 comp tb2.campo2. The bifurcation for the same is TB1, TB2 - They are the names of the tables from which records are merged. field1, field2 - They are the names of the fields that are combined. If they are numeric fields must be of the same data type and contain the same data type, but do not have to have the same name. And comp - Is any relational comparison operator: =, <,<>, <=, =>, or>.
Reply With Quote
  #5  
Old 06-11-2009
Member
 
Join Date: Apr 2008
Posts: 2,001
Re: Usiing Internal and External union SQL Queries

Here you can use an INNER JOIN operation in any FROM clause. This creates an equivalent combination, also known as internal union. The combination are the most common equivalents, they combine the records from two tables whenever there is a commonality of values common to both tables. You can use INNER JOIN with the Departments and Employees tables to select all employees in each department. On the contrary, to select all departments (even if some of them have no employees assigned) LEFT JOIN is used or all employees (even if one is not assigned to any department), in this case RIGHT JOIN.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Using Internal and External union SQL Queries"
Thread Thread Starter Forum Replies Last Post
Internal/External DNS rileymartin Windows Server Help 11 22-03-2011 09:29 PM
How to use an internal SATA HDD as an external HDD?? deepu_bhai Operating Systems 2 22-10-2010 12:03 AM
Using an internal hdd as external, unsafe ? MahaGuru Hardware Peripherals 4 13-02-2009 11:39 AM
Using an external hdd as internal hdd? HyperCity Hardware Peripherals 2 13-02-2009 11:24 AM
Internal & External DNS jckylen Windows Server Help 5 01-06-2008 02:11 AM


All times are GMT +5.5. The time now is 03:06 PM.