Solved

Sql parameters

Posted on 2011-02-12
5
448 Views
Last Modified: 2012-05-11
In "create view", what do new attribute names represent such as in

create view dept_info(dept_name, no_of_emps, total_sal) <------
as select     dname, count (*), sum (salary)
     from        department, employee
     where     dnumber = dno
     group by dname;

0
Comment
Question by:JCW2
5 Comments
 
LVL 40

Expert Comment

by:Sharath
ID: 34880361
What do you mean by new attributes? In your example dname, count of dname and sum of salary would be represented with column names as dept_name,no_of_emps and total_Sal in the view.
0
 

Author Comment

by:JCW2
ID: 34880444
I'm referring to what is in the parenthesis to the left of the arrow.
0
 
LVL 7

Expert Comment

by:printnix63
ID: 34880472
Your create view statement will never work. You chose different names inside the view than the table names you query. You can do this, but then you have to explicitly assign the new View-Fieldnames to the queried table names. Like below example:

create view dept_info(
      dept_name, no_of_emps, total_sal)
as
      select  dname AS dept_name,
                  count(*) AS no_of_emps,
                      sum(salary) AS total_sal
     from        department, employee
     where     dnumber = dno
     group by dname;
0
 
LVL 20

Accepted Solution

by:
Muhammad Wasif earned 500 total points
ID: 34880475
These are the view column names.
0
 

Author Closing Comment

by:JCW2
ID: 34880593
Thank you for your help.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

APEX (Application Express) is used to develop a web application from Oracle. SQL Workshop is one of the tools that comes with Oracle APEX to query or modify the database objects or to make any changes to the structure.
Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now