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

207
Views
SQL, agregue más información para las columnas

Ok, tengo un problema un poco complicado de explicar y de entender:

Tengo una base de datos postgreSQL que contiene tablas con columnas, y quiero agregar información sobre cada columna, así que hago una "tabla de servicio" que se ve así:

 +---------------+-----------+--------------------+----------+----------+ | 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 | | ... | ... | ... | ... | ... | +---------------+-----------+--------------------+----------+----------+

Las columnas utype y ucd son únicas.

Mi problema es:

Hago una solicitud en mi db.

Ejemplo: Seleccione * de la entidad:

Resultado:

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

También quiero recuperar toda la información sobre mis columnas en mi consulta con mi tabla de servicios:

Algo como esto:

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

Etiqueta: ucd = ucd:etiqueta, utype = utype:EntityLabel, datatype=char

Nivel: ucd = ucd:nivel, utype = utype:EntityLevel, tipo de datos=int

Sé cómo tener el nombre de todas las columnas del resultado de mi consulta, pero no sé cómo tener toda la información sobre ellas:

Yo tengo eso:

 Select * from servicetable where columnName = 'queryColumnName'

Pero columnName no es único en la tabla de servicios, por lo que puede devolver más de una fila.

Espero que hayas entendido mi problema. Gracias

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Realmente no entendí pero intentaré ayudar.

1) Ya tiene información sobre tablas y columnas en postgresql. Ejemplo:

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

2) ¿Por qué no agrega un filtro más como "Y tabla = 'Entidad'"?

Intenta explicar más sobre tu problema.

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!