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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T16:43:41+00:00 2026-06-03T16:43:41+00:00

I have a table called games (unique by an int). I have a table

  • 0

I have a table called games (unique by an int).

I have a table called members (unique by username).

In each game, a maximum of 6 members can be involved at one time.

However, a member can resign from a game – BUT I still need to keep a record they had been involved in that game.

I need to do the following separate searches:

  1. Active games for a member.

  2. Resigned games for a member.

  3. Searches in games for an empty slot (ie a place not filled by a member).

What would be the best table structure for this?
Should I put a text field in for a member with a list of all resigned games separated by a comma? (A problem I can see with this is I will ultimately need the games information for these games, so I will subsequently need to do a separate search on the games table for each of these game numbers. That seems really slow work for the server.)

In games, should I have 6 text fields, eg SLOT1, SLOT2 etc with the present player’s username? But again, what about resigned members?

NOW THE MAIN PART OF MY QUESTION (which caused all the confusion above):

How would I set up my indexes on my tables?

When I am doing searches, I will be looking in games looking at the SLOTS1, etc to see if there are any matches with a player’s username. So this is an 6 times ORed search. What do I do to optimise the indexes on the database for these actions?

Then depending on how I do the resigned members for each game, how do I do an index then?

  • 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-03T16:43:44+00:00Added an answer on June 3, 2026 at 4:43 pm

    Use a cross-reference table. This is a table with three columns, game (a foreign key to table games), user (a foreign key to table users), and player_number (a nullable integer between 1 and 6, to indicate which “seat” is occupied by the player; null indicates that the player resigned). (Variations are possible on this depending on exactly how your game works and how you want stuff to fit together, but the main thing is that you have foreign keys to games and users.)

    The primary key in the above suggestion would be (game, user, player_number) or (user, game, player_number) at your convenience.

    It is much easier (both for you and for your database) to search a cross-reference table like this than it is to do a query that involves ORing across six columns.

    It is probably a good idea to switch to an integer primary key for the users table, as suggested by @Jermin Bazazian.

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

Sidebar

Related Questions

I have one mysql table called 'games' with the fields: id, team1, team2, and
I have a table called Visits : ID(PKey,Int) PatiendID(int), DoctorID(int), ExpectedDate(date), ActualDate(date), How can
I have a table called Activities and for each activity I can have zero
I have table called posts in my DB. Each post has field called social_network
We have a table called table1 ... (c1 int indentity,c2 datetime not null,c3 varchar(50)
I have a table called tblRentalRates with the following columns: rate_id (int) rate_startdate (datetime)
I have an N x 2 table of integers called games[ , ]. The
I have table called FinalForgotten which only contains one field called aname. The field
I have table called location with a field area. This field can contain various
I have a table called 'games' that has a column in it called 'week'.

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.