Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 369467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T13:55:21+00:00 2026-05-12T13:55:21+00:00

the question is Which of the following methods for providing explicit names for the

  • 0

the question is

Which of the following methods for providing explicit names for the columns in a view work?

a. Include a column list
b. Provide column aliases in the view SELECT statement
c. Rename the columns when you select from the view

answer

a. Works: Include a column list
b. Works: Provide column aliases in the view SELECT statement
c. Does not work: Rename the columns when you select from the view

regarding (c) what do they mean by “Rename the columns when you select from the view”?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T13:55:21+00:00Added an answer on May 12, 2026 at 1:55 pm

    I think the question in the certification guide is worded poorly. You can give explicit names to columns when you select from a view, and this works:

    CREATE VIEW MyView AS SELECT a, b, c FROM MyTable;
    SELECT a AS d, b AS e, c AS f FROM MyView;
    

    The problem is not with giving aliases to columns explicitly. Here’s the problem: if you rely on this instead of defining the view with distinct column names, and the view consists of a join such that the column names are ambiguous, you run into trouble:

    CREATE VIEW MyView AS 
      SELECT m.a, m.b, m.c, o.a, o.b, o.c 
      FROM MyTable m JOIN OtherTable o;
    

    This is not a valid view, because in the view definition, all column names must be distinct. For instance, you would get ambiguous results when you query the view:

    SELECT a FROM MyView;
    

    Does this select the first a column or the second a column?

    So you must have a distinct set of column names in the view definition, it’s not enough to make them distinct as you query the view.

    This is the reason I think the certification guide question was poorly worded. It’s not about renaming columns explicitly, it’s about ensuring that the columns of the view have distinct names. This is a common reason for renaming columns, so that’s probably why the person writing the question wrote it that way.


    Either of the other techniques mentioned in the question can resolve the ambiguity:

    CREATE VIEW MyView (a, b, c, d, e, f) AS 
      SELECT m.a, m.b, m.c, o.a, o.b, o.c 
      FROM MyTable m JOIN OtherTable o;
    

    or

    CREATE VIEW MyView AS 
      SELECT m.a, m.b, m.c, o.a AS d, o.b AS e, o.c AS f 
      FROM MyTable m JOIN OtherTable o;
    

    Either way, you get the aliased columns:

    SELECT * FROM MyView; -- returns result with columns a, b, c, d, e, f
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I had a question answered which raised another one, why following does not work?
Quick question, I have the following string which is a coma separated list of
I am trying to solve the following question which was part of a programming
Following from my last question which @Jon Skeet gave me a lot of help
my question is the following, which is the best way of working XML (kml)
I am trying to solve the following question : A sequence in which the
Can anyone help me in the following question please? Define a macro which has
In answering another question, someone showed me the following tutorial, in which the author
This should be a pretty straightforward question. I have the following code, which forms
I might have pretty basic question about regex. I have the following regex, which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.