Does Squirrel SQL or Oracle have a way to alias table names in queries?
-
19-09-2019 - |
Question
I'm using Squirrel SQL with Oracle. I often have to write quick queries for tables with longish names. It would be nice if I could give aliases to them and write queries like "select * from ft where n='blah'" instead of "select * from footablelongname where nameField='blah'".
I wouldn't use that sort of thing in applications, but it would be nice for off the cuff queries.
In theory I suppose I could create a new view for each one, but in it would be nice to be able to do this in Squirrel SQL.
Solution
Get AutoCompletion ;-) Oracle's free SQL Developer has a nicely working one.
OTHER TIPS
You could use synonyms for this, but I personally wouldn't recommend it - sure, you save a few characters typing, but you make things much worse for anyone maintaining your code later.
In the "Objects" tab right-click on the table name and select "Copy Object Name" or "Copy Qualified Object Name" and paste it into the SQL tab.