Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Joining sql views in oracle sql

How can I join views using sql? I'm using Oracle at the moment?

Sql view 1

CREATE VIEW florence_staff AS
SELECT *
FROM staff
WHERE libname ='florence'

Sql view 2

CREATE VIEW alexandria_staff AS
SELECT *
FROM staff
WHERE libname ='alexandria'

I'm doing this to check if the fragmentation is correct, if you get what i mean. Thanks :))

like image 275
getaway Avatar asked Nov 29 '25 08:11

getaway


1 Answers

These will be distinct result sets as the libname is different so use UNION ALL rather than UNION

SELECT * FROM florence_staff
UNION ALL
SELECT * FROM alexandria_staff
like image 176
Martin Smith Avatar answered Nov 30 '25 22:11

Martin Smith



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!