Today I Learned.../MySQL(40)
-
[LeetCode MySQL] 183. Customers Who Never Order
183. Customers Who Never Order Suppose that a website contains two tables, the Customers table and the Orders table. Write a SQL query to find all customers who never order anything. Table: Customers +----+-------+ | Id | Name | +----+-------+ | 1 | Joe | | 2 | Henry | | 3 | Sam | | 4 | Max | +----+-------+ Table: Orders +----+------------+ | Id | CustomerId | +----+------------+ | 1 | 3 | | 2 |..
2021.01.11 -
[LeetCode MySQL] 1179. Reformat Department Table
1179. Reformat Department Table Table: Department +---------------+---------+ | Column Name | Type | +---------------+---------+ | id | int | | revenue | int | | month | varchar | +---------------+---------+ (id, month) is the primary key of this table. The table has information about the revenue of each department per month. The month has values in ["Jan","Feb","Mar","Apr","May","Jun","Jul","Au..
2021.01.11 -
[HackerRank MySQL] Type of Triangle
Type of Triangle Write a query identifying the type of each record in the TRIANGLES table using its three side lengths. Output one of the following statements for each record in the table: Equilateral: It's a triangle with 3 sides of equal length. Isosceles: It's a triangle with 2 sides of equal length. Scalene: It's a triangle with 3 sides of differing lengths. Not A Triangle: The given values ..
2021.01.11 -
[HackerRank MySQL] Draw The Triangle 1 & 2 - information_schema.tables
Draw The Triangle 1 P(R) represents a pattern drawn by Julia in R rows. The following pattern represents P(5): * * * * * * * * * * * * * * * Write a query to print the pattern P(20). set @star = 21; select repeat('* ', @star := @star -1) from information_schema.tables limit 20 Draw The Triangle 2 P(R) represents a pattern drawn by Julia in R rows. The following pattern represents P(5): * * * * *..
2021.01.05 -
[HackerRank MySQL] INNER JOIN 문제풀기 (Basic)
Asian Population Given the CITY and COUNTRY tables, query the sum of the populations of all cities where the CONTINENT is 'Asia'. Note: CITY.CountryCode and COUNTRY.Code are matching key columns. Input Format The CITY and COUNTRY tables are described as follows: select sum(city.population) from city inner join country on city.countrycode = country.code where continent = 'asia' African Cities Giv..
2021.01.05 -
[HackerRank MySQL] Weather Observation Station 2, 13-17 - ROUND & TRUNCATE (Basic)
Weather Observation Station 2 Query the following two values from the STATION table: The sum of all values in LAT_N rounded to a scale of 2 decimal places. The sum of all values in LONG_W rounded to a scale of 2 decimal places. Input Format The STATION table is described as follows: where LAT_N is the northern latitude and LONG_W is the western longitude. Output Format Your results must be in th..
2021.01.05