2014-09-09 (Java Software Development Project--practical face question 3)

Source: Internet
Author: User

3, A, B, c three people playing cards, played a total of 100, the results of each disk are saved in the score table.

Please use SQL The statement identifies the maximum score of each of the three people in which innings, the output bureau number and the highest score.

Field name

Property

Note

Id

Int ( self-increment )

Bureau number

Optiona

Int

The results of armour

Optionb

Int

B's Results

Optionc

Int

The results of C

Answer:

CREATE TABLE Test (
Id Number (10),
Optiona Number (10),
OPTIONB Number (10),
Optionc Number (10)
);
INSERT into Test values (1,70,73,76);
INSERT into Test values (2,90,93,96);
INSERT into Test values (3,80,83,86);

SELECT * FROM Test
Select Id,optiona from Test where optiona= (select Max (optiona) from test)
Union
Select Id,optionb from Test where optionb= (select Max (optionb) from test)
Union
Select Id,optionc from Test where optionc= (select Max (optionc) from test);

(Welcome to the prawn to give a better answer)

2014-09-09 (Java Software Development Project--practical face question 3)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.