CodeSignal Intro Databases #1 ProjectList. Algorithm,알고리즘,LeetCode,Codefights,CodeSignal,코드파이트,코드시그널,예제,그래프,Graph,example,c++,java,재귀,recursive,datastructure,techinterview,coding,코딩인터뷰,기술면접, 데이터베이스, sql, query, 쿼리
CodeSignal Intro Databases #1
Q.
Your boss wants to identify the successful projects running in your company, so he asked you to prepare a list of all the currently active projects and their average monthly income.
You have stored the information about these projects in a simple database with a single Projects table that has five columns:
상사가 회사에서 이뤄지는 성공적인 프로젝트들을 구분하길 바래서, 너에게 최근 진행중인 모든 프로젝트의 리스트와 평균 월 수입을 준비하길 바란다.
다섯개의 컬럼이 있는 Projects 테이블에서 이 프로젝트들의 정보를 저장해왔다.
- internal_id: the company's internal identifier for the project;
- project_name: the official name of the project;
- team_size: the number of employees working on the project;
- team_lead: the name of the project manager;
- income: the average monthly income of the project.
Your boss says that internal project ids are irrelevant to him and that he isn't interested in how big the teams are. Since that's the case, he wants you to create another table by removing the internal_id and team_size columns from the existing Projects table. Return it sorted by internal_id in ascending order.
보스는 프로젝트 아이디는 본인과 상관없고, 팀이 얼마나 큰지도 관심없다고 했다.
그래서, internal_id 와 team_size 컬럼을 제외하고 Projects 테이블을 찾는다. internal_id 의 오름차순으로 정렬한다.
Example
For the following table Projects
internal_id, project_name, team_size, team_lead, income
1384 | MapReduce | 100 | Jeffrey Dean | 0 |
2855 | Windows | 1000 | Bill Gates | 100500 |
5961 | Snapchat | 3 | Evan Spiegel | 2000 |
the resulting table should be 위의 테이블은 아래와 같이 결과가 나와야 한다.
project_nameteam_leadincome
MapReduce | Jeffrey Dean | 0 |
Windows | Bill Gates | 100500 |
Snapchat | Evan Spiegel | 2000 |
- [execution time limit] 10 seconds (mysql)
Process
// Process
//1. You should SELECT project_name, team_lead, income
//2. In Projects table
//3. Order by internal_id in ascending
// 처리과정
//1. project_name, team_lead, income 을 찾는데,
//2. Projects 라는 테이블에서 찾고,
//3. 찾은 결과를 internal_id 오름차순으로 정렬해서 SELECT 한다.
Code.. lemme see example code!!!
코드.. 예제코드를 보자!!!
/*Please add ; after each select statement*/
CREATE PROCEDURE projectList()
BEGIN
SELECT project_name, team_lead, income FROM Projects
ORDER BY internal_id ASC;
END
Something else you might like...?
2019/02/19 - [Life/Health care] - Lysine 라이신 usage/side effects/dosage 효과/효능/부작용/성인,소아 용법, 복용법
2019/02/28 - [Life/Health care] - Vitamin K, 비타민 K usage/side effects/dosage 효능/부작용/성인,소아 용법