Hello,
Very new to Toad and data in general so please forgive my ignorance. I am used to Microsoft Access where I can drag and drop tables and create relationships and have Access create a static table off a query I built. I am trying to do the same thing in Toad for Oracle but am having trouble. I have my query built the way I like it, but can't find a simple way to export my query to a table in order to reference that table in another query.
For example, this is my generated query:
I want to be able to reference that table in another query and eventually export my "master query" to Excel.
Please help, thank you.
Query Builder aside, you could create a view.
Create or replace view my_awesome_view as
select something complicated
from some_table;
Then you can select from my_awesome_view as if it were a table.
Thanks for the quick response, John.
Could you please explain how to create a view? I am still going through the free Toad lessons and I am getting there, but I would honestly probably need this explained to me like I am 10.
Here is my canvas:
End goal is this: Those values in the original Query Results I sent should be constantly being updated. I will be adding other data to further expand the query, but that data is available in other tables that I need to link later on.
If I can get Toad to continually update the data from this query and create this as an autoupdating table, I would then like to create another query linking other raw data to this previously created query where I only show those specific parameters I would like to see.
Does that make sense?
Hi Seth.
A view is a "continually updating table". It basically just stores your query in the database and then you can reference it by name. So its data will always be up to date with the underlying tables.
You can click here to create a view from what you have so far, then start query builder fresh and then you can can join things to my_awesome_view rather than deal with the SQL to that you needed to create it.
Thanks for explaining John, that worked!
As a follow up question: Is there a way to have the view not stored on the database, but elsewhere?
No, but you can make a subquery instead of a view. I believe you can do this with the query builder, but to be honest I'm not exactly sure how. In pure SQL, it would look like this:
with empdept as
(select e.ename, e.empno, e.job, d.loc
from emp e, dept d
where e.deptno = d.deptno)
select *
from empdept; -- you could join something else to empdept here if you want.
Ok thank you, John. I appreciate your replies!