I am new to SQL. We have some code that should work on SQL Server 2005/2008, Oracle 10 as well as Sybase.
I was writing a script to try to figure out which tables a
From the Microsoft SQL Server documentation, FROM is optional.
Short Answer: Luceros answer is correct: it is optional
I have to maintain sql and adapt it between sql-server and Oracle. Here are some rules:
ORACLE Select statements need a from clause you can use from DUAL
At this place the FROM
is optional (SQL Server, Oracle, Sybase).
However, there are subtle differences: Oracle for instance allows assigning an alias to the table name, where SQL Server doesn't; and other things are also a little bit different.
Also note that your FROM
sample is differnet from the following where it is mandatory:
DELETE phone_book FROM some_table WHERE ...