본문 바로가기

order by12

SQL Basics - Trimming the Field 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.. 2022. 6. 26.
SQL: Disorder 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() 2022. 6. 25.
GROCERY STORE: Inventory 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.. 2022. 6. 20.
Best-Selling Books (SQL for Beginners #5) 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.. 2022. 6. 19.
SQL with Street Fighter: Total Wins It's time to assess which of the world's greatest fighters are through to the 6 coveted places in the semi-finals of the Street Fighter World Fighting Championship. Every fight of the year has been recorded and each fighter's wins and losses need to be added up. Each row of the table fighters records, alongside the fighter's name, whether they won (1) or lost (0), as well as the type of move tha.. 2022. 6. 14.
SQL Basics: Simple WHERE and ORDER BY For this challenge you need to create a simple SELECT statement that will return all columns from the people table WHERE their age is over 50 people table schema id name age You should return all people fields where their age is over 50 and order by the age descending NOTE: Your solution should use pure SQL. Ruby is used within the test cases to do the actual testing. Solution: SELECT * FROM peo.. 2022. 5. 12.