SQL Developer code tips

September 28, 2009

Few code tips for SQL Developer 2.1 (EA is available on OTN).

Create query with few keystrokes

1. s then pause, or hit ctrl-space

in dropdown choose select * from

2. select * from then space

in dropdown choose multiple table names while holding the ctrl key. Suppose you have chosen dept and emp. The table/view names are auto aliased by default.

3. select * from dept d, emp e where then space

in dropdown choose the join condition d.depno=e.empno.

Multiple equality join conditions could be selected while holding ctrl key.

4. Return to the select clause, delete wildcard, and fire code insight. The column list allows multiple selections as well.

Automatic Group By

When assembling aggregation with group by query, don’t rush writing group by clause — it would be appended automatically. For example in the query

select deptno, count(1) from dept

as soon as you finished the aggregate function the group by clause would appear. If you edit the column list, then the group by list is adjusted automatically. (However, if you edit group by clause, then the column list is left unchanged).


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: