Entering a query in the conceptual order
Terence_H
Posts: 3 Bronze 3
in SQL Prompt
Not sure if this is even possibly, but it it was, the wizards at Redgate might be able to do it?
Is there not a way in which a sql query can be 'constructed' in text in the conceptual order of evaluation (ie - logicaly), but the translated by SQL prompt into the accepted sql query..
IE:
enter into editor:
from Books b
left join Authors a on a.id = b.authorID
where Title = 'My book'
select b.Title, b.ISBN, a.Name
order by 1
It is a little pedantic, but would save some 'scrolling' up and down. currently you first do ssf tableA and then go and fix your columns afterward... Would be nice if everything in life was 'logical'
Just a thought, use it, don't use, but please don't judge
Is there not a way in which a sql query can be 'constructed' in text in the conceptual order of evaluation (ie - logicaly), but the translated by SQL prompt into the accepted sql query..
IE:
enter into editor:
from Books b
left join Authors a on a.id = b.authorID
where Title = 'My book'
select b.Title, b.ISBN, a.Name
order by 1
It is a little pedantic, but would save some 'scrolling' up and down. currently you first do ssf tableA and then go and fix your columns afterward... Would be nice if everything in life was 'logical'
Just a thought, use it, don't use, but please don't judge
Use it, don't use it, your choice - just don't judge me for speaking my mind
Tagged:
Best Answer
-
James R Posts: 104 Silver 4Hey @Terence_H ,
Thanks for the suggestion!
Unfortunately I'm not sure there's a lot we can do about the structure of SQL - it would certainly need a lot of thought put into it.
It's definitely a cool idea though, could you post a suggestion to our Uservoice page https://redgate.uservoice.com/forums/94413-sql-prompt and potentially we'd get round to investigating the idea if it gets voted on.
A workaround might be to make use of some existing snippet functionality in SQL Prompt. If you change the order of placeholders you can automatically get the cursor to move between code - potentially even back to the columns in a SELECT.
For example, a simple modification of the 'ssf' snippet could look like 'SELECT $column$ FROM $table$', and if you list $column$ as the second placeholder it will prompt you to type the table name first, followed by the columns.
Sorry I couldn't be more help!
Regards,
James
Software Engineer
Redgate Software
Answers