Search code examples
sqldivision

SQLite - DB Browser


How can I use SQL to calculate Feet and inches from a column that gives the Height value?

Example Height = 65 I need to transform into Feet and inches, by dividing 65/12 = 5 feet 42 inches. I am new, so What is the function that I need to use?

Thanks


Solution

  • You can use division and modulo. Most SQL dialects have a concatenation function or operator:

    select Concat(65/12, ' feet ', 65 % 12, ' inches')
    

    5 feet 5 inches