SlideShare a Scribd company logo
Modern Database Management 11th Edition by Jeffrey A. Hoffer
Use the UNION statement to provide a combined listing of care center names and their locations
as well as laboratories and their location. The list should be sorted by location, in ascending
order. (You should use aliases to rename the fields in this query.)
Please provide results!
Solution
The UNION operator is used to combine the result-set of two or more SELECT statements.The
UNION operator selects only distinct values by default. To allow duplicate values, use the ALL
keyword with UNION.
Syntax:
SELECT column_name(s) FROM table1
UNION ALL
SELECT column_name(s) FROM table2;
Now Let us consider that there are two tables namely care_center_t and laboratory_t where the
care_center_t contains rows like care_center name ,location1 and the laboratory_t consists of
rows such as laboratories and Locations2.
SELECT operator is used in selecting of particular rows from the table. So, now we select rows
namely care_center_name and location1 from care_center_t table and Loboratories and location2
from laboratory_t table.
The Database Query for the above problem is
SELECT care_center_name as name,location1 as location from care_center_t
UNION all
Select laboratory as name ,location2 as location from laboratory_t

More Related Content

PPTX
MYSQL using set operators
PPTX
Computer Science:Sql Set Operation
PPT
PPT
PPTX
MySQL JOIN & UNION
PPT
SQL200.2 Module 2
PDF
DBMS Nested & Sub Queries Set operations
PPT
Les07 (using the set operators)
MYSQL using set operators
Computer Science:Sql Set Operation
MySQL JOIN & UNION
SQL200.2 Module 2
DBMS Nested & Sub Queries Set operations
Les07 (using the set operators)

Similar to Modern Database Management 11th Edition by Jeffrey A. HofferUse th.pdf (20)

PPT
e computer notes - Using set operator
PPTX
set operators.pptx
PPT
Les08 set operators by Szabist for the MS and MPM
PPT
Les04 Displaying Data from Multiple Tables.ppt
PPTX
Sql server ___________ (advance sql)
PPT
plsql Les07
PDF
Aggregate functions in sql
PPTX
Oracle: Joins
PPTX
Oracle: Joins
PPTX
SQL JOIN
PPT
Displaying Data from Multiple Tables - Oracle Data Base
PPT
Query Formulation with Structured Query Language
PPTX
MergeResult_2024_02_09_08_59_11.pptx
PPTX
Day-2 SQL Theory_V1.pptx
PPT
Using the set operators
PPT
Les05 (Displaying Data from Multiple Table)
e computer notes - Using set operator
set operators.pptx
Les08 set operators by Szabist for the MS and MPM
Les04 Displaying Data from Multiple Tables.ppt
Sql server ___________ (advance sql)
plsql Les07
Aggregate functions in sql
Oracle: Joins
Oracle: Joins
SQL JOIN
Displaying Data from Multiple Tables - Oracle Data Base
Query Formulation with Structured Query Language
MergeResult_2024_02_09_08_59_11.pptx
Day-2 SQL Theory_V1.pptx
Using the set operators
Les05 (Displaying Data from Multiple Table)
Ad

More from info309708 (20)

PDF
Pluto has been hard to measure from Earth because of its atmosphere. .pdf
PDF
Loops and ArraysObjectivesArrays are a series of elements consi.pdf
PDF
Let f X Y be a function.True or FalseA sufficient condition for f .pdf
PDF
Its your third week on the job at Panache Inc. Last week, you made.pdf
PDF
In JAVA Write a program that uses a two-dimensional array to sto.pdf
PDF
How do CCMI model help with the improvements and comparison of the p.pdf
PDF
How would you implement a node classs and an edge class to create .pdf
PDF
How do you evaluate your own global mind set levelsSolutionAN.pdf
PDF
Here are two datasetsDataset A 64 65 66 68 70 71 72Dataset B .pdf
PDF
Getting StartedCreate a class called Lab8. Use the same setup for .pdf
PDF
For this homework, you will develop a class called VendingMachine th.pdf
PDF
Discuss what is SSH and the advantages and disadvantages of using it.pdf
PDF
Describe the differences between the three major physical connection .pdf
PDF
Create a student record management system using linked list and queu.pdf
PDF
Coca-Cola companyStrategic Goals and Objectivesi. Objectives are.pdf
PDF
C programming. Answer question only in C code Ninth Deletion with B.pdf
PDF
Biology LabThe poisonous wastes of diptheria germs are called (A).pdf
PDF
Aside from the expansion of industrial capitalism, what factors affe.pdf
PDF
Yates (2009) notes that unions have a purpose broader than serving t.pdf
PDF
write a C program for blinking light using function make sure it.pdf
Pluto has been hard to measure from Earth because of its atmosphere. .pdf
Loops and ArraysObjectivesArrays are a series of elements consi.pdf
Let f X Y be a function.True or FalseA sufficient condition for f .pdf
Its your third week on the job at Panache Inc. Last week, you made.pdf
In JAVA Write a program that uses a two-dimensional array to sto.pdf
How do CCMI model help with the improvements and comparison of the p.pdf
How would you implement a node classs and an edge class to create .pdf
How do you evaluate your own global mind set levelsSolutionAN.pdf
Here are two datasetsDataset A 64 65 66 68 70 71 72Dataset B .pdf
Getting StartedCreate a class called Lab8. Use the same setup for .pdf
For this homework, you will develop a class called VendingMachine th.pdf
Discuss what is SSH and the advantages and disadvantages of using it.pdf
Describe the differences between the three major physical connection .pdf
Create a student record management system using linked list and queu.pdf
Coca-Cola companyStrategic Goals and Objectivesi. Objectives are.pdf
C programming. Answer question only in C code Ninth Deletion with B.pdf
Biology LabThe poisonous wastes of diptheria germs are called (A).pdf
Aside from the expansion of industrial capitalism, what factors affe.pdf
Yates (2009) notes that unions have a purpose broader than serving t.pdf
write a C program for blinking light using function make sure it.pdf
Ad

Recently uploaded (20)

PPTX
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
PDF
Weekly quiz Compilation Jan -July 25.pdf
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PDF
Indian roads congress 037 - 2012 Flexible pavement
PDF
IGGE1 Understanding the Self1234567891011
PDF
A systematic review of self-coping strategies used by university students to ...
PDF
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
PPTX
UV-Visible spectroscopy..pptx UV-Visible Spectroscopy – Electronic Transition...
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PDF
1_English_Language_Set_2.pdf probationary
PDF
Complications of Minimal Access Surgery at WLH
PDF
LDMMIA Reiki Yoga Finals Review Spring Summer
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
medical_surgical_nursing_10th_edition_ignatavicius_TEST_BANK_pdf.pdf
PDF
RMMM.pdf make it easy to upload and study
PDF
advance database management system book.pdf
PDF
Classroom Observation Tools for Teachers
PDF
Hazard Identification & Risk Assessment .pdf
PDF
SOIL: Factor, Horizon, Process, Classification, Degradation, Conservation
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
Weekly quiz Compilation Jan -July 25.pdf
Chinmaya Tiranga quiz Grand Finale.pdf
Indian roads congress 037 - 2012 Flexible pavement
IGGE1 Understanding the Self1234567891011
A systematic review of self-coping strategies used by university students to ...
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
UV-Visible spectroscopy..pptx UV-Visible Spectroscopy – Electronic Transition...
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
1_English_Language_Set_2.pdf probationary
Complications of Minimal Access Surgery at WLH
LDMMIA Reiki Yoga Finals Review Spring Summer
Final Presentation General Medicine 03-08-2024.pptx
medical_surgical_nursing_10th_edition_ignatavicius_TEST_BANK_pdf.pdf
RMMM.pdf make it easy to upload and study
advance database management system book.pdf
Classroom Observation Tools for Teachers
Hazard Identification & Risk Assessment .pdf
SOIL: Factor, Horizon, Process, Classification, Degradation, Conservation

Modern Database Management 11th Edition by Jeffrey A. HofferUse th.pdf

  • 1. Modern Database Management 11th Edition by Jeffrey A. Hoffer Use the UNION statement to provide a combined listing of care center names and their locations as well as laboratories and their location. The list should be sorted by location, in ascending order. (You should use aliases to rename the fields in this query.) Please provide results! Solution The UNION operator is used to combine the result-set of two or more SELECT statements.The UNION operator selects only distinct values by default. To allow duplicate values, use the ALL keyword with UNION. Syntax: SELECT column_name(s) FROM table1 UNION ALL SELECT column_name(s) FROM table2; Now Let us consider that there are two tables namely care_center_t and laboratory_t where the care_center_t contains rows like care_center name ,location1 and the laboratory_t consists of rows such as laboratories and Locations2. SELECT operator is used in selecting of particular rows from the table. So, now we select rows namely care_center_name and location1 from care_center_t table and Loboratories and location2 from laboratory_t table. The Database Query for the above problem is SELECT care_center_name as name,location1 as location from care_center_t UNION all Select laboratory as name ,location2 as location from laboratory_t