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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:18:21+00:00 2026-06-01T02:18:21+00:00

To clarify – there will be up to 4 distinct players in the table,

  • 0

To clarify – there will be up to 4 distinct players in the table, referenced by their ids. I want to enforce this, i.e. no two ids are the same.

Also, because it’s up to 4 players, some may be null. Is potentially having many nulls like this a bad idea? I don’t think it does, but just to be sure, does null == null return false?

...
CHECK (playerid1 <> playerid2)
  AND (playerid1 <> playerid3)
  AND (playerid1 <> playerid4)
  AND (playerid2 <> playerid3)
  AND (playerid2 <> playerid4)
  AND (playerid3 <> playerid4)
...

Thank you!

  • 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-01T02:18:22+00:00Added an answer on June 1, 2026 at 2:18 am

    I’d use a separate table for this:

     create table game_players (
          game_id number, player_id number, player_position number
        );
    

    Then you can add

    • a UNIQUE constraint for game_id+player id (to enforce a player doesn’t occur more than once per game)
    • a UNIQUE constraint for game_id+player_position (to ensure a position is occupied by at most one player)
    • a CHECK constraint for player_position to enforce it only has the values 1, 2, 3 or 4

    This should achieve what you want in a somewhat cleaner (IMHO) way.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just want to clarify one thing. This is not a question on which
EDIT Just to clarify, there is no intent of putting this into production. Purely
I should clarify that I am looking for a client-side solution. Alternatively, is there
To clarify, multiple students objects and all of them are getting the same value.
Let me clarify this a bit... I have a class that handles XML files.
To clarify: no I can't make this pure PHP5 yes this code works in
EDIT: Just to clarify, the query is correct - there are zero rows -
I want to clarify how the following code works.I have itemized my doubts to
To clarify my question :-) I want to have the best of both worlds.
I want to clarify refactoring in scope of TDD. Before: class Somclass{ public void

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.