본문 바로가기

전체 글93

[HackerRank] 여러 개의 INNER JOIN : New Companies 1. 문제 Amber's conglomerate corporation just acquired some new companies. Each of the companies follows this hierarchy: Given the table schemas below, write a query to print the company_code, founder name, total number of lead managers, total number of senior managers, total number of managers, and total number of employees. Order your output by ascending company_code. Note: The tables may contai.. 2021. 3. 22.
[HackerRank] Japan Population / Weather Observation Station 2 / Weather Observation Station 18 1) Japan Population 1. 문제 Query the sum of the populations for all Japanese cities in CITY. The COUNTRYCODE for Japan is JPN. Input Format The CITY table is described as follows: 2. 답 SELECT SUM(population) FROM city WHERE countrycode = "JPN" 3. KEY POINT SUM(컬럼명) : 해당 컬럼의 합 www.hackerrank.com/challenges/japan-population/problem?h_r=internal-search Japan Population | HackerRank Query to the sum .. 2021. 3. 22.
[LeetCode] 175. Combine Two Tables 1. 문제 Table: Person +-------------+---------+ | Column Name | Type | +-------------+---------+ | PersonId | int | | FirstName | varchar | | LastName | varchar | +-------------+---------+ PersonId is the primary key column for this table. Table: Address +-------------+---------+ | Column Name | Type | +-------------+---------+ | AddressId | int | | PersonId | int | | City | varchar | | State | va.. 2021. 3. 22.
[LeetCode] 182. Duplicate Emails 1. 문제 Write a SQL query to find all duplicate emails in a table named Person. +----+---------+ | Id | Email | +----+---------+ | 1 | a@b.com | | 2 | c@d.com | | 3 | a@b.com | +----+---------+ For example, your query should return the following for the above table: +---------+ | Email | +---------+ | a@b.com | +---------+ Note: All emails are in lowercase. 2. 답 SELECT Email FROM Person GrOUP BY E.. 2021. 3. 22.
[LeetCode] 620. Not Boring Movies 1. 문제 X city opened a new cinema, many people would like to go to this cinema. The cinema also gives out a poster indicating the movies’ ratings and descriptions. Please write a SQL query to output movies with an odd numbered ID and a description that is not 'boring'. Order the result by rating. For example, table cinema: +---------+-----------+--------------+-----------+ | id | movie | descript.. 2021. 3. 22.
[LeetCode] 595. Big Countries 1. 문제 There is a table World +-----------------+------------+------------+--------------+---------------+ | name | continent | area | population | gdp | +-----------------+------------+------------+--------------+---------------+ | Afghanistan | Asia | 652230 | 25500100 | 20343000 | | Albania | Europe | 28748 | 2831741 | 12960000 | | Algeria | Africa | 2381741 | 37100000 | 188681000 | | Andorra .. 2021. 3. 22.