javadb syntax error
i am using javadb and using the following line in it and
i am using the natural command and the javadb is saying that natural is a syntax error , kindly tell me how it can be a syantax error.
I used the following line as :
select AccessionNumber, b , c from app.ab natural join app.bookinfo
Actually , i am having AccessionNumber as the common field in both the tables.
kindly tell me any another way if it is not possible this way.
Because "natural join" is not part of the SQL standards. inner join, left outer join, right outer join, full outer join, cross join. Those are the SQL standard join forms.
Edit: P.S. where in the SQL Syntax manual that comes with the JavaDB download did you find reference to "natural join"?
I wonder too.
Originally Posted by masijade
Dear Sir: A Natural Join exists in Javadb (Derby) and in mySQL. For other interested parties, the link to the Javadb join documentation can be found here. Derby Reference Manual
One possible problem might be in the table names. You are using: select AccessionNumber, b , c from app.ab natural join app.bookinfo.
Try this: select AccessionNumber, b , c from ab natural join bookinfo
I am basing this syntax on a similar relationship of tables I am using in MySQL. It would take about an hour to describe this, so I'm going to skip it.
Why use a Natural Join? (From "Learning PHP & MySQL", Davis, Phillips, O'Reilly Publishing, 2006, p. 141) "You can specify the NATURAL JOIN keyword to accomplish the same query with less typing. With natural joining, MySQL can take two tables and automatically join the fields that have the same name... the natural join is smart enough not to display title_id twice (found in both databases) and ...etc.
As pointed out, there are alternatives, but the concept exists. If you are still stuck include more information, database structure and so forth. Sincerely--G.O.
Relying on consistent naming across tables.
That way lies madness.
ETA: sSpecifically the idea that an id column on a table should be named something other than "id".
I agreed. But some people does.
But then some people also think the world is flat...
Make lots of trouble on me as well, when I'm starting with ongoing developments, rather from scratch.