Database design -请看我的编辑。 select max(NoOfWords), Score from table where NoOfWords <= UserNumberOfWords select field1, field2, field3,rawsco
-请看我的编辑。Database design -请看我的编辑。 select max(NoOfWords), Score from table where NoOfWords <= UserNumberOfWords select field1, field2, field3,rawsco,database-design,db2,Database Design,Db2,-请看我的编辑。 select max(NoOfWords), Score from table where NoOfWords <= UserNumberOfWords select field1, field2, field3,rawscore, ( select max(percentage) from scorelookup where words < r.rawscore ) rank from scores r; select field1, field
select max(NoOfWords), Score from table
where NoOfWords <= UserNumberOfWords
select field1, field2, field3,rawscore, (
select max(percentage) from scorelookup where words < r.rawscore ) rank
from scores r;
select field1, field2, field3,raw, (
select max(percentage) from scorelookup where scoreable < r.rawscore and quiz='Test2' ) rank
from scores r;
CREATE TABLE gameScoreThresholds (
game_id INTEGER NOT NULL,
raw_score SMALLINT NOT NULL,
score_percentage SMALLINT NOT NULL
)
;
CREATE UNIQUE INDEX gamescoreidx ON gameScoreThresholds(game_id, raw_score) CLUSTER
;
ALTER TABLE gameScoreThresholds ADD PRIMARY KEY (game_id, raw_score)
;
SELECT score_percentage FROM gameScoreThresholds
WHERE game_id = ? AND raw_score <= ?
ORDER BY raw_score DESC
FETCH FIRST ROW ONLY
;