Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what does this error mean "column used in NATURAL join cannot have qualifier"

Tags:

sql

oracle11g

After executing the code below, i get an ORA-25155 error

SELECT p.prod_id, prod_name, prod_list_price,quantity_sold,cust_last_name
FROM products p NATURAL JOIN sales s NATURAL JOIN customer c
WHERE prod_id = 148;
like image 510
Marvic Avatar asked Dec 03 '25 02:12

Marvic


1 Answers

As suggested on a comment, this ORA-25155 error suggests that you're qualifying the column name "p.prod_id" instead of just "prod_id". That is what is triggering your error.

Try this fully working SQL Fiddle code. Your query should be:

SELECT prod_id, prod_name, prod_list_price,quantity_sold,cust_last_name
  FROM products
       NATURAL JOIN sales
       NATURAL JOIN customer
 WHERE prod_id = 148;

A NATURAL JOIN over multiple tables will join one pair of tables, then join the third table to the result and so forth. NATURAL JOIN syntax has no explicit join predicate, so the qualifiers aren't used there.

like image 52
Yaroslav Avatar answered Dec 04 '25 16:12

Yaroslav



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!