To write custom SQl query in magento is very easy we have to just need to call
$db = Mage::getSingleton('core/resource')->getConnection('core_write');
$result=$db->query("SELECT * FROM PCDSTable");