SQL UNION - Introduction and syntax
SQL Union - Dec 03, 2008 at 18:00 PM by Rajmeet Ghai
Explain the SQL UNION statement. Write SQL syntax for the SQL UNION statement
along with an example.
SQL UNION: The UNION operator is used to combine the result-set
of two or more SELECT statements Tables of both the select statement must have
the same number of columns with similar data types. It eliminates duplicates.
Syntax:
SELECT column_name(s) FROM table_name1 UNION SELECT column_name(s)
FROM table_name2
Example:
SELECT emp_Name FROM Employees_india
UNION SELECT emp_Name FROM Employees_USA
SQL Union - May 18, 2009 at 10:00 AM by
Rajmeet Ghai
What is the difference between UNION and UNION ALL?
UNION command selects distinct and related information from two
tables. On the other hand, UNION ALL selects all the values from
both the tables.
Also read
Answer - CUBE generates a result set that
represents aggregates for all combinations of values in the selected
columns.......
Answer - Database users can have permission to
execute a stored procedure without being....
Answer - The start and end of each
transaction......
Answer - A transaction is a set
of operations that works as a single unit. The ransactions can be
categorized into explicit, autocommit, and implicit....
Define temporary and
extended stored procedure.
Answer - Temporary Stored Procedure is stored in
TempDB database. It is volatile and is deleted once connection gets
terminated or server is restarted......
Define Primary and Unique
key.
Answer - The column or columns of the table
whose value uniquely identifies each row in the table is called
primary key. You can define column as primary key using primary key
constraint while you create table.....
What is index? Define its
types.
Answer - Index can be thought as index of the book that is used for
fast retrieval of information. Index uses one or more column index
keys and pointers to the record to locate
record.........
|