0

So I am new in SQL DEVELOPER tools and I have written a simple select statement like:

SELECT * FROM employee;

it worked fine but there was a yellow warning mark underneath SELECT and I clicked on that and my query changes into the following query:

SELECT "A1"."EMPLOYEE_ID" "EMPLOYEE_ID","A1"."FIRST_NAME" "FIRST_NAME","A1"."LAST_NAME" "LAST_NAME","A1"."SALARY" "SALARY", "A1"."DEPARTMENT_ID" "DEPARTMENT_ID","A1"."MANAGER_ID" "MANAGER_ID","A1"."HIRE_DATE" "HIRE_DATE"
FROM "INTRO_USER"."EMPLOYEE" "A1";

My Quest is what is the difference between these two queries? although their output is the same

Lyokolux
  • 1,227
  • 2
  • 10
  • 34
  • https://stackoverflow.com/questions/65512/which-is-faster-best-select-or-select-column1-colum2-column3-etc – Mat Apr 12 '20 at 14:20
  • Does this answer your question? [Which is faster/best? SELECT \* or SELECT column1, colum2, column3, etc](https://stackoverflow.com/questions/65512/which-is-faster-best-select-or-select-column1-colum2-column3-etc) – Adrian Mole Apr 12 '20 at 16:08

2 Answers2

0

The glob * has been expanded to all column of the table. The table name EMPLOYEE is aliased to A1 to make it shorter.

Lyokolux
  • 1,227
  • 2
  • 10
  • 34
  • Thanks for your reply, I have checked it and changed aliased A1 to B1(query works perfectly fine if I change A1 to B!) and still, I got the yellow mark under SELECT and it showed A1. why so? can't we aliased our table name as the way we want? – Mahmodul Hasan Apr 12 '20 at 23:07
  • I don't know more. This is my limit :') – Lyokolux Apr 13 '20 at 10:30
0

The feature you are seeing is called 'SQL Text Expansion,' and it's setup to allow you to see what your query would look like if you were working with one or more VIEWS.

For example, SELECT * FROM ALL_TABLES is quite complicated. This feature allows you to see what's actually involved when running that SQL.

enter image description here

https://www.thatjeffsmith.com/archive/2014/12/sql-developer-and-a-12c-magic-trick/

There is probably no change or expected delta in the performance or execution plan of the 2 versions of your query.

thatjeffsmith
  • 20,522
  • 6
  • 37
  • 120
  • 1
    Great - I wasn't aware of this. (You can tell that I use the keyboard to type my queries - very rarely touch the mouse!) I added a link for those - like me - who are seeing this here for the first time. If you have a better link, by all means please change it. –  Apr 12 '20 at 19:32