Solved

Sql parameters

Posted on 2011-02-12
5
451 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 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

Is Your DevOps Pipeline Leaking?

Is your CI/CD pipeline a hodge-podge of randomly connected tools? You’ve likely got a tool to fix one problem & then a different tool to fix another, resulting in a cluster of tools with overlapping functionality. Learn how to optimize your pipeline with Gartner's recommendations

Question has a verified solution.

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

Creating and Managing Databases with phpMyAdmin in cPanel.
These days, all we hear about hacktivists took down so and so websites and retrieved thousands of user’s data. One of the techniques to get unauthorized access to database is by performing SQL injection. This article is quite lengthy which gives bas…
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…

732 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