Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

166
Vistas
Is having the foreign key as the primary key a good idea in this situation?

I have a main user table which has some common attributes of a user (name , email, phone) and then I have 2 more tables (lets say x and y) that contain the different attributes of the two types of users. You may say (x1, x2, x3) and (y1, y2, y3). One user may only be of one type. I have an 'user_id' column in the x and y table and a primary key column. the 'user_id' column references the 'id' column in the user table. Would it be correct if I remove the 'id' column (which serves as primary Key) in the x and y table and instead used the 'user_id' column as the primary and forign key. im using postgres 9.6.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Your scenario is perfectly fine , no problem with that. It is known as super-type and sub-type in database terminology .

To read more about that , visit the link .

http://sqlmag.com/t-sql/sql-design-supertypes-and-subtypes

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda