ORA-00928: missing SELECT keyword. Please explain

Viewed 286

Why I am getting this error? Where should I add the SELECT keyword?

CREATE VIEW norders 
AS N1 
    SELECT n_ame, AVG(purch_amt), SUM(purch_amt) 
    FROM Salesman, orders
    WHERE Salesman.salesman_id = orders.salesman_id 
    GROUP BY n_ame;
1 Answers

the problem is that 'N1' . not sure what are you trying to do there but here is the right syntax:

but also never use comma to join

Create View norders AS
Select n_ame, Avg(purch_amt) avgpurch, Sum(purch_amt) sumpurch
From Salesman s
JOIN orders o
  On s.salesman_id = o.salesman_id 
Group By n_ame;
Related