GRANT SELECT,INSERT,UPDATE,DELETE ON database_name.table_name TO ‘USER’@’HOSTNAME’;
Tag Archives: MySQL
Magento Custom Query Modify Category Page Layout
Run the below given script . It will set the value “’three_columns’” to the field “Page Layout” of all categories .
$write = Mage::getSingleton(‘core/resource’)->getConnection(‘core_write’);
$updateQry = “UPDATE catalog_category_entity_varchar SET value=’three_columns’ WHERE attribute_id=’61’ “;
$write->query($updateQry);
Magento Custom Query Insert Data
$write = Mage::getSingleton(‘core/resource’)->getConnection(‘core_write’);
$insertQry = “INSERT INTO customer_entity_int (entity_type_id, attribute_id) VALUES(1, 224)”;
$write->query($insertQry);
Magento Custom Query Update Data
$write = Mage::getSingleton(‘core/resource’)->getConnection(‘core_write’);
$updateQry = “UPDATE catalog_category_entity_varchar SET value=’three_columns’ WHERE attribute_id=’61’ “;
$write->query($updateQry);
Magento Custom Query Select Data
$read = Mage::getSingleton(‘core/resource’)->getConnection(‘core_read’);;
$selectQry = “SELECT * FROM catalog_category_entity”;
$write->query($selectQry);
How to write a Custom SQL Query Magento
To select the data
$read = Mage::getSingleton(‘core/resource’)->getConnection(‘core_read’);;
$selectQry = “SELECT * FROM catalog_category_entity”;
$write->query($selectQry);
To add/modify data
$write = Mage::getSingleton(‘core/resource’)->getConnection(‘core_write’);
$updateQry = “UPDATE catalog_category_entity_varchar SET value=’three_columns’ WHERE attribute_id=’61’ “;
$write->query($updateQry);
Magento Custom Query
To select the data
$read = Mage::getSingleton(‘core/resource’)->getConnection(‘core_read’);;
$selectQry = “SELECT * FROM catalog_category_entity”;
$write->query($selectQry);
To add/modify data
$write = Mage::getSingleton(‘core/resource’)->getConnection(‘core_write’);
$updateQry = “UPDATE catalog_category_entity_varchar SET value=’three_columns’ WHERE attribute_id=’61’ “;
$write->query($updateQry);
Find out mysql version linux
mysql -V
mysql Ver 14.14 Distrib 5.1.61, for debian-linux-gnu (i686) using readline 6.1
Dimensional Model
The dimensional model is a specialized adaptation of the relational model used to represent data in data warehouses in a way that data can be easily summarized using OLAP queries. In the dimensional model, a database schema consists of a single large table of facts that are described using dimensions and measures. A dimension provides the context of a fact (such as who participated, when and where it happened, and its type) and is used in queries to group related facts together. Dimensions tend to be discrete and are often hierarchical; for example, the location might include the building, state, and country. A measure is a quantity describing the fact, such as revenue. It’s important that measures can be meaningfully aggregated–for example, the revenue from different locations can be added together.
Multivalue Model
Multivalue databases are ‘lumpy’ data, in that they can store exactly the same way as Relational Databases, but they also permit a level of depth which the relational model can only approximate using sub-tables. This is nearly identical to the way XML expresses data, where a given field/attribute can have multiple right answers at the same time. Multivalue can be thought of as a compressed form of XML.