FicoScore

an anonymous user · November 25, 2022
CREATE TABLE Persons (
    ID int,
    LastName varchar(255),
    FirstName varchar(255),
    Gender varchar(255),
    Race varchar(255),
    FicoScore int
);

INSERT INTO Persons VALUES (101, 'Sheng', 'Xinyuan', 'F', 'Asian', 780);
INSERT INTO Persons VALUES (102, 'Yu', 'Yue', 'M', 'Asian', 769);
INSERT INTO Persons VALUES (137, 'Biden', 'Joe', 'M', 'White', 779);
INSERT INTO Persons VALUES (321, 'Harris', 'Kamala', 'F', 'Black', 763);
INSERT INTO Persons VALUES (264, 'Putin', 'Vladimir', 'M', 'White', 621);
INSERT INTO Persons VALUES (001, 'Xi', 'Jinping', 'M', 'Asian', 666);
INSERT INTO Persons VALUES (013, 'Peng', 'Liyuan', 'F', 'Asian', 698);
INSERT INTO Persons VALUES (299, 'Noah', 'Trevor', 'M', 'Black', 774);
INSERT INTO Persons VALUES (250, 'Trump', 'Donald', 'M', 'White', 667);
INSERT INTO Persons VALUES (234, 'Trump', 'Melania', 'F', 'White', 725);

SELECT ID, LastName, Gender, Race, FicoScore
FROM Persons
WHERE gender = 'F' OR race = 'Asian'
GROUP BY Race
ORDER BY Gender DESC, FicoScore DESC
LIMIT 2
Output
(Run the program to view its output)

Comments

Please sign up or log in to contribute to the discussion.