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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:31:40+00:00 2026-06-11T15:31:40+00:00

I am learning SQL and have some tables much like the following: Person (id*,

  • 0

I am learning SQL and have some tables much like the following:

Person (id*, name)
Customer(id*, is_active, ...)
Employee(id*, department_id, ...)

(the * indicates the primary key, which in the case of Customer and Employee is both a PK and a FK back to Person)

Both Customer and Employee are types of Person, and I want to ensure that when a record is inserted into Person a record must also be inserted into EITHER Customer or Employee but NOT both. A Person cannot be both an employee and customer within the limits of this example.

I have been told that a Trigger would be useful to enforce this constraint. Could somebody please explain the usage of a trigger with this simple example?

  • 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-06-11T15:31:41+00:00Added an answer on June 11, 2026 at 3:31 pm

    Depending on what your DBMS supports and other factors, you can either:

    • Insert via a stored procedure that is implemented to ensure the correct behavior.
    • Or use a trigger on a view (that JOINs a supertype with particular subtype) to make the view “updatable” and then insert into the view.
    • Or ensure both exclusivity and presence of subtypes through purely declarative means, as explained here.
    • Or use an implementation strategy for inheritance different from “all classes in separate tables”, as mentioned here.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a newbie, just learning SQL and have this question: I have two tables
I'm in the process of learning Databases and SQL. From what I have read
I am learning sql injections and very interested how to cause this. I have
I decided to learn how to use an ORM to avoid learning some SQL
I am learning to use mysql.So, I got some problems. I have three table
I'm fairly new to SQL Server and am still learning some of the tricks
Just a basic question. Learning Linq to SQL and some nHibernate. I am using
I am still learning much about SQL queries but found myself stuck on this.
Hi I am interested in learning SQL databases something I should have done a
I am learning SQL Server by exercising some problems. In one of that problems

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.