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 7041359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:02:03+00:00 2026-05-28T02:02:03+00:00

In sqlite3, I can force two columns to alias to the same name, as

  • 0

In sqlite3, I can force two columns to alias to the same name, as in the following query:

SELECT field_one AS overloaded_name,
       field_two AS overloaded_name
FROM my_table;

It returns the following:

overloaded_name  overloaded_name
---------------  ---------------
1                2
3                4
...              ...

… and so on.

However, if I create a named table using the same syntax, it appends one of the aliases with a :1:

sqlite> CREATE TABLE temp AS
          SELECT field_one AS overloaded_name,
                 field_two AS overloaded_name
          FROM my_table;
sqlite> .schema temp
CREATE TABLE temp(
  overloaded_name TEXT,
  "overloaded_name:1" TEXT
);

I ran the original query just to see if this was possible, and I was surprised that it was allowed. Is there any good reason to do this? Assuming there isn’t, why is this allowed at all?

EDIT:

I should clarify: the question is twofold: why is the table creation allowed to succeed, and (more importantly) why is the original select allowed in the first place?

Also, see my clarification above with respect to table creation.

  • 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-28T02:02:04+00:00Added an answer on May 28, 2026 at 2:02 am

    I can force two columns to alias to the same name…
    why is [this] allowed in the first place?

    This can be attributed to the shackles of compatibility. In the SQL Standards, nothing is ever deprecated. An early version of the Standard allowed the result of a table expression to include columns with duplicate names, probably because an influential vendor had allowed it, possibly due to the inclusion of a bug or the omission of a design feature, and weren’t prepared to take the risk of breaking their customers’ code (the shackles of compatibility again).

    Is there any use to duplicate column names in a table?

    In the relational model, every attribute of every relation has a name that is unique within the relevant relation. Just because SQL allows duplicate column names that doesn’t mean that as a SQL coder you should utilise such as feature; in fact I’d say you have to vigilant not to invoke this feature in error. I can’t think of any good reason to have duplicate column names in a table but I can think of many obvious bad ones. Such a table would not be a relation and that can’t be a good thing!

    why is the [base] table creation allowed to succeed

    Undoubtedly an ‘extension’ to (a.k.a purposeful violation of) the SQL Standards, I suppose it could be perceived as a reasonable feature: if I attempt to create columns with duplicate names the system automatically disambigutes them by suffixing an ordinal number. In fact, the SQL Standard specifies that there be an implementation dependent way to ensure the result of a table expression does not implicitly have duplicate column names (but as you point out in the question this does not perclude the user from explicitly using duplicate AS clauses). However, I personally think the Standard behaviour of disallowing the duplicate name and raising an error is the correct one. Aside from the above reasons (i.e. that duplicate columns in the same table are of no good use), a SQL script that creates an object without knowing if the system has honoured that name will be error prone.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I export data from an sqlite3 database in Objective-c? Can I issue
Can someone tell me how to access a sqlite3 database from perl. the code
Now that we can Examining sqlite3 Databases from a Remote Shell , is it
How can I build a query with this format with a sqlite3 database? CREATE
i have a problem that i can't solve ! (sqlite3, but i think it
I can't get SQLite Driver working in my sessionfactory. I downloaded SQLite 1.0.48 from
I was wondering if PhoneGap can work with local SQLite3 databases and what level
I can't insert data into sqlite table. Here is my code: import sqlite3 connection
i am looking to execute the following commands within a shell script: $ sqlite3
When attempting to query text fields in SQLite I get force closes if the

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.