In this recipe, we will learn how to retrieve data using raw SQL for when PHQL doesn't meet our needs. Although PHQL does a lot, and can be extended by using custom database specific dialects, it isn't always enough. It would be terrible if we were simply out of luck and unable to fulfill a niche need and fortunately, Phalcon is able to get out of the way and to provide us raw SQL access to our database service. This means that we can use PHQL based technology for almost everything in our system and then, if we hit a wall, we can switch over to writing the query directly with SQL.
Note: One potential downside to consider when using raw SQL is that if we are doing so to implement database implementation specific vendor features then it could make our system no longer able to work with other databases.