Solved

Sql parameters

Posted on 2011-02-12
5
450 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
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…

830 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