Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

209
Views
SQL, add more informations for columns

Ok, I have a problem a bit complicated to explicate and to understand:

I have a postgreSQL DataBase who contains tables with columns, and I want to add some informations about each column, so I make a "service table" who look like this:

+---------------+-----------+--------------------+----------+----------+
| ColumnName    |  ucd      |       utype        | datatype |  table   |
+---------------+-----------+--------------------+----------+----------+
| ident         | ucd:ident | utype:EntityId     | char     | Entity   |
| label         | ucd:label | utype:EntityLabel  | char     | Entity   |
| level         | ucd:level | utype:EntityLevel  | int      | Entity   |
| idAct         | ucd:Acti  | utype:ActivityId   | char     | Activity |
| label         | ucd:label | utype:ActivityLb   | char     | Activity |
| ...           | ...       | ...                | ...      | ...      |
+---------------+-----------+--------------------+----------+----------+

The utype and ucd columns are unique

My problem is:

I do a request on my db.

Exemple: Select * from entity:

Result:

+-------+---------+-------+
| ident |  label  | level |
+-------+---------+-------+
|     1 | Entity1 |     1 |
|     2 | Entity2 |     2 |
|     3 | Entity3 |     2 |
+-------+---------+-------+

I also want to recover all the informations about my columns in my query whit my service table:

Something like this:

Ident: ucd = ucd:ident, utype = utype:EnetityId, datatype=char

Label: ucd = ucd:label, utype = utype:EntityLabel, datatype=char

Level: ucd = ucd:level, utype = utype:EntityLevel, datatype=int

I know how to have all the columns name of the result of my query, but I don't know how to have all the information about them:

I have that:

Select * from servicetable
where columnName = 'queryColumnName'

But columnName is not unique in service table so,it may return more than one row.

I hope you have understand my problem. Thank you

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

I really did not understand but I'll try help.

1) You already have some information about tables and columns on postgresql. Example:

SELECT *
FROM information_schema.columns
WHERE table_schema = 'your_schema'
AND table_name   = 'your_table';

2) Why dont you add one more filter like " AND table = 'Entity'" ?

Try explain more about your problem.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!