English 中文(简体)
MySQL——最佳化指数——与游戏有关的用户
原标题:MySQL - Index Optimisation - Users associated with game

我有一个称为游戏的桌子(用斜体表示)。

我的表格称为成员(按用户名称分列)。

在每次游戏中,最多可有6名成员参加一次。

然而,一名成员可以辞职,但BUTI仍需要保存他们参与这一游戏的记录。

我需要进行以下单独搜查:

  1. a 成员积极游戏。

  2. a. 成员再分配游戏。

  3. • 寻找一个空档游戏(即一个成员没有填满的地方)。

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.)

在游戏中,我是否拥有6个文字领域,如SLOT1、SLOT2等,目前参与者的用户名? 但同样,辞职的成员是什么?

千年问题的主要部分(造成上述所有混乱):

我如何在我的表格上制定我的指数?

在我进行搜查时,我将研究一下SLOTS1的游戏,以便了解是否与参与者的用户名称相匹配。 因此,这是一次6次被搁置的搜索。 我为这些行动选择数据库中的指数做了些什么?

然后,取决于我如何为每次游戏辞退成员,那么我怎么做指数呢?

最佳回答

采用对照表。 该表有三栏:<编码>> (a foreign key to table (表users_player_ number/code> (a) 在1至6年间进行无理的分类,以表明参与者占领了哪些“se”; (这取决于您的游戏如何运作以及你想要如何共同生活,但主要问题是,你有外国钥匙来<条码>、<条码>和<条码>用户。)

以上建议的主要要点是<代码>(加梅、用户、角色编号)(用户、游戏、角色编号)

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.

如“Jermin Bazazian”所建议的,改用“密码>用户表格的主要关键词可能是一个好的想法。

问题回答

暂无回答




相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

php return a specific row from query

Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I ve found return a 2 dimensional array to access specific rows. I want to be able to ...

Character Encodings in PHP and MySQL

Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I ...

Pagination Strategies for Complex (slow) Datasets

What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don t want to hit the DB for every page view. Currently there are ~...

Averaging a total in mySQL

My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to ...

热门标签