Solved

Sql parameters

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

This article describes some very basic things about SQL Server filegroups.
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.
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…

744 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

15 Experts available now in Live!

Get 1:1 Help Now