SQL69 Easy SQL: Moving Values You have access to a table of monsters as follows: ** monsters table schema ** id name legs arms characteristics Your task is to make a new table where each column should contain the length of the string in the column to its right (last column should contain length of string in the first column). Remember some column values are not currently strings. Column order and titles should remain unchang.. 2022. 5. 29. Grasshopper - Terminal game move function Terminal game move function In this game, the hero moves from left to right. The player rolls the dice and moves the number of spaces indicated by the dice two times. In SQL, you will be given a table moves with columns position and roll. Return a table which uses the current position of the hero and the roll (1-6) and returns the new position in a column res. Example: move(3, 6) should equal 15.. 2022. 5. 29. Grasshopper - Check for factor This function should test if the factor is a factor of base. Return true if it is a factor or false if it is not. About factors Factors are numbers you can multiply together to get another number. 2 and 3 are factors of 6 because: 2 * 3 = 6 You can find a factor by dividing numbers. If the remainder is 0 then the number is a factor. You can use the mod operator (%) in most languages to check for.. 2022. 5. 26. SQL Basics: Maths with String Manipulations Given a demographics table in the following format: demographics table schema id name birthday race return a single column named calculation where the value is the bit length of name, added to the number of characters in race. Solution: SELECT BIT_LENGTH(name)+ CHAR_LENGTH(race) AS calculation FROM demographics 'BIT_LENGTH' can obtain the bit length. 'CHAR_LENGTH' or 'LENGTH' can obtain the char.. 2022. 5. 25. SQL Basics: Simple MIN / MAX or this challenge you need to create a simple MIN / MAX statement that will return the Minimum and Maximum ages out of all the people. people table schema id name age select table schema age_min (minimum of ages) age_max (maximum of ages) Solution: SELECT MIN(age) AS age_min, MAX(age) AS age_max FROM people Result: age_min age_max 11 99 2022. 5. 24. SQL Basics: Simple JOIN For this challenge you need to create a simple SELECT statement that will return all columns from the products table, and join to the companies table so that you can return the company name. products table schema id name isbn company_id price companies table schema id name You should return all product fields as well as the company name as "company_name". NOTE: Your solution should use pure SQL... 2022. 5. 23. 이전 1 ··· 6 7 8 9 10 11 12 다음