If you’ve browsed Oracle APEX’s features you must have seen the Quick SQL in the SQL Workshop. But have you ever used it? Do you know the shortcut? If not, have a look at this post to understand better this amazing tool.
What is Quick SQL?
According to the Oracle Documentation
Quickly develop a script for simple tables and views.
Quick SQL provides a quick way to generate the SQL required to create a relational data model from an indented text document.
Quick SQL is designed to reduce the time and effort required to create SQL tables, triggers, and index structures. This tool is not designed to be a replacement for data modeling. Instead, Quick SQL is simply a quick way to develop a script for simple tables and views. Once you have generate the SQL, you can then tweak and expand it.
From this quote, you can see that it is not design to replace traditional SQL Development, it is just a tool to help speed up the development of simple routines that sometimes take longer than they should.
Where can I test it?
If you have Oracle APEX, you can open it in SQL Workshop -> Utilities -> Quick SQL
If you don’t have it, then you should go get it, it’s free 🙂 . But if you really in a hurry, then try https://apex.oracle.com/quicksql
As you’ll see, quick SQL is easy to use, you just add some text, indentation and shorthands for stuff you want. Take a look at the example below
On the left side is what I’ve wrote and on the right side is the actual script being generated. Can you see from this simple example how much writing quick sql did for me? I’ve only wrote the table name, indented to write the columns with some shorthands for things like data types and not null. And when I wrote “date_of_birth” i didn’t have to write anything. And the Primary key came as a bonus.
By pressing Enter or “Generate SQL” it keeps updating the right side, so I knew what was happening all the time.
Let’s add a bit more
Ok, that may have been a bit too easy, let’s add
- check constraints
- a child table
- audit columns (auditing in the trigger)
This simple addition made it difficult to fit the right side content, so I’m adding it bellow
Where can I learn more?
The good news is that Oracle provides a lot of content to study.
The bad news is that, as far as i know, only Oracle has content about it
Quick SQL Documentation: https://docs.oracle.com/en/database/oracle/application-express/20.2//aeutl/using-quick-sql.html#GUID-21EE36C2-F814-48C0-90EA-7D464E9014FD
Shorthands and Datatype: I don’t have a link for that, I have a path. with Quick SQL opened, click on help and you’ll get all the datatypes, table and column directives that you can use (check image below)
One final tip
Take a look at the sample files, you won’t believe how much you’ll learn from them.
That’s it, good studies and good luck