-
New Day, new error (subqueries)
This morning I read through an introduction to Oracle/SQL that I found online. Despite this I am still getting an error when I try and execute this CREATE VIEW statement. I either get that the "sql statement was not ended properly" (even though there are semicolons after) or that there is a "missing right parentheses" (even though all brackets are there).
Here is my script:
create view densview as
select sampyear, sptype from density
(count * from density where sptype='S' or sptype='H');
I have also tried
create veiw densview as
select sampyear, sptype from
(select count (*) from
(select count (*) from density
where sptype='S') where sptype='H')
group by sampyear, sptype
order by sampyear;
I tried to base my script off of this example that I found in the introduction manual:
select ename, sal from emp
where empno in
(select pmgr from project where pstart <'31-DEC-90')
AND deptno=20;
Any tips/other resources I could be referring myself to to helpe me learn this would be fantastic. Thanks!
-
Hi,
I already post an answer to your other question "embedded count".
Just put the words :
"create or replace view densview as "
in front of the query in my answer and you will have the complete solution.
The "or replace" part is when the view already exists, it will be replaced. With views it is a good practice to always use "create or replace".
GC
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|