본문 바로가기

Algorithm/Code Fights (Code Signal)

CodeSignal Intro Databases #6 VolleyballResults. Algorithm,알고리즘,LeetCode,Codefights,CodeSignal,코드파이트,코드시그널,예제,그래프,Graph,example,c++,java,재귀,recursive,datastructure,techinterview,coding,코딩인터뷰,기술면..

CodeSignal Intro Databases #6 VolleyballResults. Algorithm,알고리즘,LeetCode,Codefights,CodeSignal,코드파이트,코드시그널,예제,그래프,Graph,example,c++,java,재귀,recursive,datastructure,techinterview,coding,코딩인터뷰,기술면접, 데이터베이스, sql, query, 쿼리

 

 

CodeSignal Intro Databases #6

Q.

 You are creating a website that will help you and your friends keep track of the results of volleyball teams from all around the world. Your website regularly crawls the web searching for new games, and adds the results of these games to the results table stored in your local database. After each update, the table should be sorted in ascending order by the total number of games won. This year's results are quite marvelous - at any given moment there are no two teams that have won the same number of games!

The results table contains the following columns:

  • name - the unique name of the team;
  • country - the country of the team;
  • scored - the number of scored goals;
  • missed - the number of missed goals;
  • wins - the total number of games the team has won.

 Your task is to sort the given results table in ascending order by the number of wins.

 

 너의 너의 친구들이 세계의 모든 배구팀들 결과를 추적하는 것을 돕는 웹사이트를 만들 것이다. 웹사이트는 규칙적으로 새로운 게임들을 크롤링하고, 로컬 데이터베이스의 results 테이블에 그 게임들의 결과를 추가한다. 각 업데이트 후에, 테이블은 총 게임 승수로 정렬한다. 올해 결과들인 좀 놀라웠다 - 어떤 두팀도 같은 게임 승수를 가진 것들이 없다.

 results 테이블은 아래 컬럼들로 되어있다.

  • name - 유일한 팀의 이름들이다.
  • country - 팀의 국가
  • scored - 점수낸 골의 수
  • missed - 놓친 골의 수
  • wins - 팀이 이긴 승수

 

 

Example

 

For given table results

 

name

country

scored

missed

wins

FC Tokyo Japan 26 28 1
Fujian China 24 26 0
Jesus Maria Argentina 25 23 3
University Blues Australia 16 25 2

 

the output should be

 

name

country

scored

missed

wins

Fujian China 24 26 0
FC Tokyo Japan 26 28 1
University Blues Australia 16 25 2
Jesus Maria Argentina 25 23 3
  • [execution time limit] 10 seconds (mysql)

 

Process

// Process 
//1. Select all column

//2. In results table

//3. Order wins in ascending

 

 

// 처리과정

//1. 모든 컬럼을 서치하는데

//2. results 테이블에서,

//3. wins 의 오름차순으로한다.

 

 

Code.. lemme see example code!!!

코드.. 예제코드를 보자!!!

 

 

/*Please add ; after each select statement*/
CREATE PROCEDURE volleyballResults()
BEGIN
	SELECT * FROM results
    ORDER BY wins ASC;
END

 

 

Something else you might like...?

 

 

2019/10/23 - [Algorithm/Code Fights (Code Signal)] - CodeSignal Intro Databases #1 ProjectList. Algorithm,알고리즘,LeetCode,Codefights,CodeSignal,코드파이트,코드시그널,예제,그래프,Graph,example,c++,java,재귀,recursive,datastructure,techinterview,coding,코딩인터뷰,기술면접, ..

2019/10/20 - [Algorithm/Leet Code] - LeetCode #181 EmployeesEarningMoreTheirManagers. Algorithm,알고리즘,LeetCode,Codefights,CodeSignal,코드파이트,코드시그널,예제,그래프,Graph,example,c++,java,재귀,recursive,datastructure,techinterview,coding,코딩인터뷰,기술면..

 

 

2019/09/04 - [Programming/C++] - How to sort vector in C++, 벡터 정렬하는 방법,sorting,배열,stl,씨쁠쁠,example code,예제코드,표준라이브러리

 

 

2019/10/09 - [Computer/General] - 정보처리기사 실기/필기 - IT신기술동향_전산영어 요점 정리

2019/10/07 - [Computer/General] - 정보처리기사 실기/필기 - 업무 프로세스 요점 정리

 

 

2019/08/14 - [Life/Item review] - Mi Band 4 review, 미밴드4 후기, 장점, 단점, 리뷰, 한글, global review, 미밴드4 글로벌 후기, 리뷰, 구매, 사용방법, setting, 세팅, ProsNCons

 

 

2019/08/27 - [Programming] - 개발자 선배들에게서 배운 것들. Things I Learnt from a Senior Software Engineer. 코딩 잘하는 방법, how to code well, 소프트웨어,프로그래머,programmer

 

 

2019/04/14 - [Programming/C++] - C++ Math - sqrt (square root, 제곱근, 루트). stl, math.h, 씨쁠쁠, example code, 예제코드

 

 

2018/10/19 - [Programming/Design Pattern ] - Design pattern - Prototype (디자인패턴 - 프로토타입) / Java C++ C#

 

 

2019/01/12 - [Algorithm/Code Fights (Code Signal)] - Aracade Intro #60 sudoku. Algorithm,알고리즘,Codefights,CodeSignal,코드파이트,코드시그널,예제,문제해결능력,example,c++,java,재귀,recursive

2019/01/12 - [Algorithm/Code Fights (Code Signal)] - Aracade Intro #59 spiralNumbers. Algorithm,알고리즘,Codefights,CodeSignal,코드파이트,코드시그널,예제,문제해결능력,example,c++,java,재귀,recursive

2019/01/08 - [Algorithm/Code Fights (Code Signal)] - Aracade Intro #58 messageFromBinaryCode. Algorithm,알고리즘,Codefights,CodeSignal,코드파이트,코드시그널,예제,문제해결능력,example,c++,java,재귀,recursive

 

 

2019/09/17 - [Algorithm/Leet Code] - LeetCode #841 KeysAndRooms. Algorithm,알고리즘,LeetCode,Codefights,CodeSignal,코드파이트,코드시그널,예제,그래프,Graph,example,c++,java,재귀,recursive,datastructure,techinterview,coding,코딩인터뷰,기술면접

2019/08/28 - [Algorithm/Leet Code] - LeetCode #821 ShortestDistanceToACharacter. Algorithm,알고리즘,LeetCode,Codefights,CodeSignal,코드파이트,코드시그널,예제,문제해결능력,example,c++,java,재귀,recursive,datastructure,techinterview,coding,코딩인터뷰,기술면접..

 

 

2018/12/28 - [Programming/Software Architecture] - Perfecting OO's Small Classes and Short Methods. 완벽한 객체지향의 작은 클래스와 짧은 메소드, Book:ThoughtWorks Anthology, Java,cpp,자바,oop,좋은코드,객체지향프로그래밍 - (#9, Tell, Don't Ask)

2018/12/26 - [Programming/Software Architecture] - Perfecting OO's Small Classes and Short Methods. 완벽한 객체지향의 작은 클래스와 짧은 메소드, Book:ThoughtWorks Anthology, Java,cpp,자바,oop,좋은코드,객체지향프로그래밍 (1)

 

 

2019/01/14 - [Programming/Java] - 자바 메모리 누수 체크/확인/고치는 방법, Memory leak check/fix in Java application, cleanCode/좋은코드/oop/객체지향

 

 

2019/02/19 - [Life/Health care] - Lysine 라이신 usage/side effects/dosage 효과/효능/부작용/성인,소아 용법, 복용법

2019/02/16 - [Life/Health care] - Finasteride 피나스테라이드,탈모약 usage/side effects/dosage 효능/부작용/효과/sexual effect/두타스테라이드/프로페시아/propecia/finpecia/카피약/copy drug/hair loss

2019/02/25 - [Life/Health care] - Folic Acid 엽산 vitaminB9,비타민M usage/side effects/dosage 효과/효능/부작용/성인,소아 용법, 복용법

2019/02/28 - [Life/Health care] - Vitamin K, 비타민 K usage/side effects/dosage 효능/부작용/성인,소아 용법

2019/03/03 - [Life/Health care] - Vitamin B1, Thiamine, 비타민 B1, 티아민 usage/side effects/dosage 효능/부작용/성인,소아 용법