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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:17:08+00:00 2026-05-17T23:17:08+00:00

I currently need to make a table that holds the unique sets of attributes

  • 0

I currently need to make a table that holds the unique sets of attributes for another table. That is, I have a table that looks like this:

Table A : columns = col 1, col2, col3, col4, col5

And I need to produce this:

Table B : columns = columnName, value
col 1, col1attribute1
col 1, col1attribute2
col 1, col1attribute3
col 2, col2attribute1
col 3, col3attribute1
col 3, col3attribute2

Is there an easy way to do this with (PL)SQL alone? It seems simple enough if I do it programatically in Java, but ideally I’d like an sql-only solution if possible.

  • 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-17T23:17:08+00:00Added an answer on May 17, 2026 at 11:17 pm

    The following seems to work:

    CREATE TABLE TABLE_B (COLUMN_NAME, VALUE) AS
      SELECT DISTINCT 'COL_1', COL_1 FROM TABLE_A
      UNION ALL
      SELECT DISTINCT 'COL_2', COL_2 FROM TABLE_A
      UNION ALL
      SELECT DISTINCT 'COL_3', COL_3 FROM TABLE_A
      UNION ALL
      SELECT DISTINCT 'COL_4', COL_4 FROM TABLE_A
      UNION ALL
      SELECT DISTINCT 'COL_5', COL_5 FROM TABLE_A;
    

    Share and enjoy.

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

Sidebar

Related Questions

I have a table which looks a bit like this: <table> <thead> <tr> <th></th>
Back story i have a table that stores cached times, and currently has about
I happen to have a database with a table that holds all possible combination
I need to make somethink like a elecction system so that people at work
I have a table, sessionBasket, that holds a list of the items in the
I am trying to make a 5x5 table that will have the numbers 1-5
I currently need to search a table of items to validate a list of
I currently have a need for a custom ListViewItem class - let's call it
The table's schema is pretty simple. I have a child table that stores a
I am currently in the process of designing a database. I have a table

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.