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/09 - [Computer/General] - 정보처리기사 실기/필기 - IT신기술동향_전산영어 요점 정리
2019/10/07 - [Computer/General] - 정보처리기사 실기/필기 - 업무 프로세스 요점 정리
2019/02/19 - [Life/Health care] - Lysine 라이신 usage/side effects/dosage 효과/효능/부작용/성인,소아 용법, 복용법
2019/02/28 - [Life/Health care] - Vitamin K, 비타민 K usage/side effects/dosage 효능/부작용/성인,소아 용법