Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Sql parameters

Posted on 2011-02-12
5
Medium Priority
?
469 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 41

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 2000 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
In today's business world, data is more important than ever for informing marketing campaigns. Accessing and using data, however, may not come naturally to some creative marketing professionals. Here are four tips for adapting to wield data for insi…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

916 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