You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{"payload":{"allShortcutsEnabled":false,"fileTree":{"database":{"items":[{"name":"_175.sql","path":"database/_175.sql","contentType":"file"},{"name":"_176.sql","path":"database/_176.sql","contentType":"file"},{"name":"_177.sql","path":"database/_177.sql","contentType":"file"},{"name":"_178.sql","path":"database/_178.sql","contentType":"file"},{"name":"_180.sql","path":"database/_180.sql","contentType":"file"},{"name":"_181.sql","path":"database/_181.sql","contentType":"file"},{"name":"_182.sql","path":"database/_182.sql","contentType":"file"},{"name":"_183.sql","path":"database/_183.sql","contentType":"file"},{"name":"_184.sql","path":"database/_184.sql","contentType":"file"},{"name":"_185.sql","path":"database/_185.sql","contentType":"file"},{"name":"_196.sql","path":"database/_196.sql","contentType":"file"},{"name":"_197.sql","path":"database/_197.sql","contentType":"file"},{"name":"_262.sql","path":"database/_262.sql","contentType":"file"},{"name":"_569.sql","path":"database/_569.sql","contentType":"file"},{"name":"_570.sql","path":"database/_570.sql","contentType":"file"},{"name":"_571.sql","path":"database/_571.sql","contentType":"file"},{"name":"_574.sql","path":"database/_574.sql","contentType":"file"},{"name":"_577.sql","path":"database/_577.sql","contentType":"file"},{"name":"_578.sql","path":"database/_578.sql","contentType":"file"},{"name":"_580.sql","path":"database/_580.sql","contentType":"file"},{"name":"_584.sql","path":"database/_584.sql","contentType":"file"},{"name":"_585.sql","path":"database/_585.sql","contentType":"file"},{"name":"_586.sql","path":"database/_586.sql","contentType":"file"},{"name":"_595.sql","path":"database/_595.sql","contentType":"file"},{"name":"_596.sql","path":"database/_596.sql","contentType":"file"},{"name":"_597.sql","path":"database/_597.sql","contentType":"file"},{"name":"_601.sql","path":"database/_601.sql","contentType":"file"},{"name":"_602.sql","path":"database/_602.sql","contentType":"file"},{"name":"_603.sql","path":"database/_603.sql","contentType":"file"},{"name":"_607.sql","path":"database/_607.sql","contentType":"file"},{"name":"_608.sql","path":"database/_608.sql","contentType":"file"},{"name":"_610.sql","path":"database/_610.sql","contentType":"file"},{"name":"_612.sql","path":"database/_612.sql","contentType":"file"},{"name":"_613.sql","path":"database/_613.sql","contentType":"file"},{"name":"_614.sql","path":"database/_614.sql","contentType":"file"},{"name":"_615.sql","path":"database/_615.sql","contentType":"file"},{"name":"_618.sql","path":"database/_618.sql","contentType":"file"},{"name":"_619.sql","path":"database/_619.sql","contentType":"file"},{"name":"_620.sql","path":"database/_620.sql","contentType":"file"},{"name":"_626.sql","path":"database/_626.sql","contentType":"file"},{"name":"_627.sql","path":"database/_627.sql","contentType":"file"}],"totalCount":41},"":{"items":[{"name":"database","path":"database","contentType":"directory"},{"name":"shell","path":"shell","contentType":"directory"},{"name":"src","path":"src","contentType":"directory"},{"name":".gitignore","path":".gitignore","contentType":"file"},{"name":".travis.yml","path":".travis.yml","contentType":"file"},{"name":"CODE_OF_CONDUCT.md","path":"CODE_OF_CONDUCT.md","contentType":"file"},{"name":"LICENSE.md","path":"LICENSE.md","contentType":"file"},{"name":"README.md","path":"README.md","contentType":"file"},{"name":"build.gradle","path":"build.gradle","contentType":"file"},{"name":"fishercoder_checkstyle.xml","path":"fishercoder_checkstyle.xml","contentType":"file"},{"name":"settings.gradle","path":"settings.gradle","contentType":"file"}],"totalCount":11}},"fileTreeProcessingTime":21.964632,"foldersToFetch":[],"incompleteFileTree":false,"repo":{"id":119512631,"defaultBranch":"master","name":"Leetcode-4","ownerLogin":"yq277","currentUserCanPush":false,"isFork":true,"isEmpty":false,"createdAt":"2018-01-30T09:22:31.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/19181683?v=4","public":true,"private":false,"isOrgOwned":false},"codeLineWrapEnabled":false,"symbolsExpanded":false,"treeExpanded":true,"refInfo":{"name":"master","listCacheKey":"v0:1619877684.108913","canEdit":false,"refType":"branch","currentOid":"a023ef631002714a0be257305ce15faac0cd2b47"},"path":"database/_178.sql","currentUser":null,"blob":{"rawLines":["-- Write a SQL query to rank scores. If there is a tie between two scores, both should have the same ranking. Note that after a tie, the next ranking number should be the next consecutive integer value. In other words, there should be no \"holes\" between ranks.","--","-- +----+-------+","-- | Id | Score |","-- +----+-------+","-- | 1 | 3.50 |","-- | 2 | 3.65 |","-- | 3 | 4.00 |","-- | 4 | 3.85 |","-- | 5 | 4.00 |","-- | 6 | 3.65 |","-- +----+-------+","-- For example, given the above Scores table, your query should generate the following report (order by highest score):","--","-- +-------+------+","-- | Score | Rank |","-- +-------+------+","-- | 4.00 | 1 |","-- | 4.00 | 1 |","-- | 3.85 | 2 |","-- | 3.65 | 3 |","-- | 3.65 | 3 |","-- | 3.50 | 4 |","-- +-------+------+","","-- # Write your MySQL query statement below","select Score,"," (select count(distinct Score) from Scores where Score \u003e= s.Score) Rank","from Scores s","order by Score desc"],"stylingDirectives":[[[0,260,"pl-c"],[0,2,"pl-c"]],[[0,2,"pl-c"],[0,2,"pl-c"]],[[0,17,"pl-c"],[0,2,"pl-c"]],[[0,17,"pl-c"],[0,2,"pl-c"]],[[0,17,"pl-c"],[0,2,"pl-c"]],[[0,17,"pl-c"],[0,2,"pl-c"]],[[0,17,"pl-c"],[0,2,"pl-c"]],[[0,17,"pl-c"],[0,2,"pl-c"]],[[0,17,"pl-c"],[0,2,"pl-c"]],[[0,17,"pl-c"],[0,2,"pl-c"]],[[0,17,"pl-c"],[0,2,"pl-c"]],[[0,17,"pl-c"],[0,2,"pl-c"]],[[0,119,"pl-c"],[0,2,"pl-c"]],[[0,2,"pl-c"],[0,2,"pl-c"]],[[0,19,"pl-c"],[0,2,"pl-c"]],[[0,19,"pl-c"],[0,2,"pl-c"]],[[0,19,"pl-c"],[0,2,"pl-c"]],[[0,19,"pl-c"],[0,2,"pl-c"]],[[0,19,"pl-c"],[0,2,"pl-c"]],[[0,19,"pl-c"],[0,2,"pl-c"]],[[0,19,"pl-c"],[0,2,"pl-c"]],[[0,19,"pl-c"],[0,2,"pl-c"]],[[0,19,"pl-c"],[0,2,"pl-c"]],[[0,19,"pl-c"],[0,2,"pl-c"]],[],[[0,43,"pl-c"],[0,2,"pl-c"]],[[0,6,"pl-k"]],[[5,11,"pl-k"],[12,17,"pl-c1"],[34,38,"pl-k"],[46,51,"pl-k"],[58,60,"pl-k"],[61,62,"pl-c1"],[63,68,"pl-c1"]],[[0,4,"pl-k"]],[[0,8,"pl-k"],[15,19,"pl-k"]]],"colorizedLines":null,"csv":null,"csvError":null,"dependabotInfo":{"showConfigurationBanner":false,"configFilePath":null,"networkDependabotPath":"/yq277/Leetcode-4/network/updates","dismissConfigurationNoticePath":"/settings/dismiss-notice/dependabot_configuration_notice","configurationNoticeDismissed":null},"displayName":"_178.sql","displayUrl":"https://github.com/yq277/Leetcode-4/blob/master/database/_178.sql?raw=true","headerInfo":{"blobSize":"934 Bytes","deleteTooltip":"You must be signed in to make or propose changes","editTooltip":"You must be signed in to make or propose changes","ghDesktopPath":"https://desktop.github.com","isGitLfs":false,"onBranch":true,"shortPath":"ed57fa2","siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2Fyq277%2FLeetcode-4%2Fblob%2Fmaster%2Fdatabase%2F_178.sql","isCSV":false,"isRichtext":false,"toc":null,"lineInfo":{"truncatedLoc":"30","truncatedSloc":"29"},"mode":"file"},"image":false,"isCodeownersFile":null,"isPlain":false,"isValidLegacyIssueTemplate":false,"issueTemplate":null,"discussionTemplate":null,"language":"SQL","languageID":333,"large":false,"planSupportInfo":{"repoIsFork":null,"repoOwnedByCurrentUser":null,"requestFullPath":"/yq277/Leetcode-4/blob/master/database/_178.sql","showFreeOrgGatedFeatureMessage":null,"showPlanSupportBanner":null,"upgradeDataAttributes":null,"upgradePath":null},"publishBannersInfo":{"dismissActionNoticePath":"/settings/dismiss-notice/publish_action_from_dockerfile","releasePath":"/yq277/Leetcode-4/releases/new?marketplace=true","showPublishActionBanner":false},"rawBlobUrl":"https://github.com/yq277/Leetcode-4/raw/refs/heads/master/database/_178.sql","renderImageOrRaw":false,"richText":null,"renderedFileInfo":null,"shortPath":null,"symbolsEnabled":true,"tabSize":8,"topBannersInfo":{"overridingGlobalFundingFile":false,"globalPreferredFundingPath":null,"showInvalidCitationWarning":false,"citationHelpUrl":"https://docs.github.com/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-citation-files","actionsOnboardingTip":null},"truncated":false,"viewable":true,"workflowRedirectUrl":null,"symbols":{"timed_out":false,"not_analyzed":true,"symbols":[]}},"copilotInfo":null,"copilotAccessAllowed":false,"modelsAccessAllowed":false,"modelsRepoIntegrationEnabled":false,"csrf_tokens":{"/yq277/Leetcode-4/branches":{"post":"GY0vWg35qlt9kqh0Z2pD3vapdKPNI5Bx4V6NXGyVfzj1Zf7Us5psTVw74b0oUApV3olIlIQWo0M9DWVAZZTz0w"},"/repos/preferences":{"post":"s9jDlQdBjFTBwoHR1jyFLNo3c1PZRDlHhjXpaSim0aiuKf0DGPqfEzPTJxM9IJA4Eqx2I0XCucToUg1ICywmrw"}}},"title":"Leetcode-4/database/_178.sql at master · yq277/Leetcode-4","appPayload":{"helpUrl":"https://docs.github.com","findFileWorkerPath":"/assets-cdn/worker/find-file-worker-7d7eb7c71814.js","findInFileWorkerPath":"/assets-cdn/worker/find-in-file-worker-1ae9fa256942.js","githubDevUrl":null,"enabled_features":{"code_nav_ui_events":false,"react_blob_overlay":false,"accessible_code_button":true,"github_models_repo_integration":false}}}