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

  • Home
  • SEARCH
  • 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 8812759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:40:40+00:00 2026-06-14T03:40:40+00:00

Well, i have a table with 4 columns( id , event_id , group_id ,

  • 0

Well, i have a table with 4 columns(id, event_id, group_id, isbn), where id is PK, event_id and group_id are FK’s, and my problem is:

I need the isbn number to be unique for each event_id, let me give you some examples of some rows that should be possible and some that should not:

 id | event_id | group_id | isbn
 (1,1,1,123) ok 
 (2,1,2,123) ok
 (3,1,4,123) ok
 (4,1,7,1234) ok
 (5,2,8,123) NOT OK, the 'isbn' must be unique for event_id('123' was already used in the first row with event_id = 1)

the group_id only appears once for each event_id, but if i make a unique contraint with the 3 columns i would be able to repeat the isbn just chaning the event_id, and i don’t want that,once an isbn is used in an event_id it cant appear in another event_id, an event_id(let’s say ‘1’) can repeat the same ibsn as longe as it needs for each group_id

I know i kind of repeated the problem several times, but is a tricky question and i want to lower the chances of getting wrong answers

EDIT1: about @Andomar answer, the isbn must be related to the group_id by the cardinality (1,n) 1-isbn -> n-group_id and the structure in the answer don’t do that

  • 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-14T03:40:41+00:00Added an answer on June 14, 2026 at 3:40 am

    What you describe is that event_id is dependant on the isbn . You need to normalize the table by splitting it into two:

    (Corrected):

    Remove Keep isbn in this – and add a FOREIGN KEY (event_id, isbn) constraint to the second table, below:

    id | event_id | group_id | isbn
     1      1          1        123 
     2      1          2        123
     3      1          4        123 
     4      1          7        1234
     5      2          8        123     --- not allowed by the FK constraint
    

    And create a new table with isbn as the primary key and a UNIQUE (event_id, isbn) key (and two foreign keys: event_id to Event table and isbn to (Book?), if you have a table where isbn is the primary or unique key):

    event_id | isbn
       1        123 
       1       1234 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Well, I'll say it like this. I have a table with 2 columns. The
I have a table where each row has a description field as well as
I have a table with unique index on two columns, id_parent and sort_order to
This question requires some hypothetical background. Let's consider an employee table that has columns
I have a MySQL table with a column of well-formed URLs. I'd like to
I have a table called TPM_TASKS which contain all tasks, as well as a
I have a UI table view with a search bar and it works well
I have a pivot table, well of course every row will be included in
Say if I have a large dataset, the table has well over a million
I have 123 tables as well: M001 -> M010 -> M123. each is a

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.