How can I properly use the WHERE clause within a UNION for both of SELECT statements

The problem I am having is that I am not sure if these WHERE clauses within my two SELECT statements are logically right to do within the UNION. I want to output only faculty members who work in the IT department and output students who are majoring in Computer Science. However, I am able to successfully output what I want, but is there another way to do this for my two WHERE clauses within the UNION. Here is my code and pic attached below. Nothing is wrong with this code I just want a more efficient way to do. I feel like it is too easy.

SELECT 
    Faculty.LastName AS 'Last', 
	Faculty.FirstName AS 'First', 
    'Faculty' AS 'Type'
FROM
    faculty
    WHERE Faculty.FirstName= 'Frank'
    
UNION 

SELECT 
	student.LastName AS 'Last', 
	student.FirstName AS 'First', 
	 'Student' AS  'Type'
FROM
    student 
	    WHERE Student.LastName= 'Harris' 
    ORDER BY Last, First; 

this is fine

there really is no easier way to pull selected rows from separate tables

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.