일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
- Sorted
- js
- count
- 위코드
- LOWER
- index
- lambda
- sum
- decorator
- 파이썬
- slice
- join
- or
- Python
- If
- list
- STR
- MAX
- FOR
- len
- map
- DART
- split
- and
- WECODE
- range
- SQL
- iNT
- enumerate
- Algorithm
- Today
- Total
목록SQL (69)
코드로 우주평화
Your friends told you that if you keep coding on your computer, you are going to hurt your eyes. They suggested that you go with them to trivia night at the local club. Once you arrive at the club, you realize the true motive behind your friends' invitation. They know that you are a computer nerd, and they want you to query the countries table and get the answers to the trivia questions. Schema ..
Task Given a table where users' connections are logged, find the first and the last address of the networks they connected from. Notes Order the result by the id column There's no need to validate anything - it's okay if the user connects from a private network (You don't need the connection_time field for this task but without it the input data looks too dull) You can read more about IPv4 on Wi..
You have access to a table of monsters as follows: monsters schema id name legs arms characteristics The monsters in the provided table have too many characteristics, they really only need one each. Your job is to trim the characteristics down so that each monster only has one. If there is only one already, provide that. If there are multiple, provide only the first one (don't leave any commas i..
You are given a table numbers with just one column, number. It holds some numbers that are already ordered. You need to write a query that makes them un-ordered, as in, every possible ordering should appear equally often. Solution: SELECT * FROM numbers ORDER BY random()
In your application, there is a section for adults only. You need to get a list of names and ages of users from the users table, who are 18 years old or older. users table schema name age NOTE: Your solution should use pure SQL. Ruby is used within the test cases just to validate your answer. Solution: SELECT name, age FROM users WHERE age >= 18
You are given a table with the following format: ** encryption table schema ** md5 sha1 sha256 Problem is the table looks so unbalanced - the sha256 column contains much longer strings. You need to balance things up. Add '1' to the end of the md5 addresses as many times as you need to to make them the same length as those in the sha256 column. Add '0' to the beginning of the sha1 values to achie..
Find the total sum of internal angles (in degrees) in an n-sided simple polygon. N will be greater than 2. Solution: SELECT 180 * (n - 2) AS res FROM angle The sum of the interior angles of an n-gon is 180˚× (n-2). Result: res 9720 12960 10080 15660 12780 5400 16920
Given a table of random numbers as follows: numbers table schema id number1 number2 Your job is to return table with similar structure and headings, where if the sum of a column is odd, the column shows the minimum value for that column, and when the sum is even, it shows the max value. You must use a case statement. output table schema number1 number2 Solution: SELECT CASE WHEN MOD(SUM(number1)..
You are the owner of the Grocery Store. All your products are in the database, that you have created after CodeWars SQL excercises!:) Today you are going to CompanyA warehouse You need to check what products are running out of stock, to know which you need buy in a CompanyA warehouse. Use SELECT to show id, name, stock from products which are only 2 or less item in the stock and are from Company..
You work at a book store. It's the end of the month, and you need to find out the 5 bestselling books at your store. Use a select statement to list names, authors, and number of copies sold of the 5 books which were sold most. books table schema name author copies_sold Solution: SELECT * FROM books ORDER BY copies_sold DESC LIMIT 5 Result: name author copies_sold The Unbearable Lightness of Bein..