$db = JFactory::getDbo(); $query = $db->getQuery(true) ->select('country_code, country_name') ->from($db->quoteName('countries')); $db->setQuery($query); //Get the result as an associative array $countries = $db->getAssocList();In this example, the getDbo() method is used to get the database object, which is then used to construct a query that selects the country_code and country_name fields from the countries table. The query is then executed using the setQuery() method and the result is obtained using the getAssocList() method. This code belongs to the Joomla package, specifically the JFactory class which is part of the Joomla CMS library.