Write sql in ruby syntax