Magento 2: How to get product name by sql query using product IDGet all Magento Categories using SQL queryHow to get customer shopping cart information using sql queryHow to find and replace product title using sql queryHow to get product name and image name from database using query?Magento 2: Get Product URL and SKU using SQL QueryHow to add product name to SQL QueryHow to get products name and sku and url key using sql query in magento 2?Modifying a query (get products using SQL only)Generate Magento 2 Product Feed with MySQL QueryMagento 2 delete search term through sql query

Are there practical reasons to NOT use a stepper motor with lead screw for the X and or Y axes?

Does any lore text explain why the planes of Acheron, Gehenna, and Carceri are the alignment they are?

How do I get a cleat that's stuck in a pedal, detached from the shoe, out?

How should I push back against my job assigning "homework"?

How to decline physical affection from a child whose parents are pressuring them?

How can I grammatically understand "Wir über uns"?

Can those paralyzed by the Hold Person spell be forcibly moved?

Do I add my ability modifier to the damage of the bonus-action attack granted by the Crossbow Expert feat?

Accidentally cashed a check twice

What is the best option to connect old computer to modern TV

Is there any Biblical Basis for 400 years of silence between Old and New Testament?

Why does my electric oven present the option of 40A and 50A breakers?

Can The Malloreon be read without first reading The Belgariad?

Does Peach's float negate shorthop knockback multipliers?

Cross Correlation, how can any signals except the trivial cases be uncorrelated?

Should we freeze the number of people coming in to the study for Kaplan-Meier test

Can a class take a different class's spell in their ritual book?

Asking bank to reduce APR instead of increasing credit limit

The term for the person/group a political party aligns themselves with to appear concerned about the general public

Why is there a need to modify system call tables in Linux?

Homophone fills the blanks

How can I offer a test ride while selling a bike?

Unconventional Opposites

Can a magnetic field of a large body be stronger than its gravity?



Magento 2: How to get product name by sql query using product ID


Get all Magento Categories using SQL queryHow to get customer shopping cart information using sql queryHow to find and replace product title using sql queryHow to get product name and image name from database using query?Magento 2: Get Product URL and SKU using SQL QueryHow to add product name to SQL QueryHow to get products name and sku and url key using sql query in magento 2?Modifying a query (get products using SQL only)Generate Magento 2 Product Feed with MySQL QueryMagento 2 delete search term through sql query






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








3















I want to access the product names by query database using product ID. How can I achieve it?










share|improve this question
























  • u want sql query or Magento default way

    – Arshad Muhammad
    Dec 21 '16 at 11:32











  • i want sql query . I know the default way.

    – Nitin Pawar
    Dec 21 '16 at 11:33











  • why do you want using SQL query?

    – chirag
    Dec 21 '16 at 11:42












  • I want to access the product names outside magento without using api.

    – Nitin Pawar
    Dec 21 '16 at 11:43

















3















I want to access the product names by query database using product ID. How can I achieve it?










share|improve this question
























  • u want sql query or Magento default way

    – Arshad Muhammad
    Dec 21 '16 at 11:32











  • i want sql query . I know the default way.

    – Nitin Pawar
    Dec 21 '16 at 11:33











  • why do you want using SQL query?

    – chirag
    Dec 21 '16 at 11:42












  • I want to access the product names outside magento without using api.

    – Nitin Pawar
    Dec 21 '16 at 11:43













3












3








3


1






I want to access the product names by query database using product ID. How can I achieve it?










share|improve this question
















I want to access the product names by query database using product ID. How can I achieve it?







magento2 product database sql






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 22 '16 at 8:06









Fabian Schmengler

55.2k21142356




55.2k21142356










asked Dec 21 '16 at 11:26









Nitin PawarNitin Pawar

79711540




79711540












  • u want sql query or Magento default way

    – Arshad Muhammad
    Dec 21 '16 at 11:32











  • i want sql query . I know the default way.

    – Nitin Pawar
    Dec 21 '16 at 11:33











  • why do you want using SQL query?

    – chirag
    Dec 21 '16 at 11:42












  • I want to access the product names outside magento without using api.

    – Nitin Pawar
    Dec 21 '16 at 11:43

















  • u want sql query or Magento default way

    – Arshad Muhammad
    Dec 21 '16 at 11:32











  • i want sql query . I know the default way.

    – Nitin Pawar
    Dec 21 '16 at 11:33











  • why do you want using SQL query?

    – chirag
    Dec 21 '16 at 11:42












  • I want to access the product names outside magento without using api.

    – Nitin Pawar
    Dec 21 '16 at 11:43
















u want sql query or Magento default way

– Arshad Muhammad
Dec 21 '16 at 11:32





u want sql query or Magento default way

– Arshad Muhammad
Dec 21 '16 at 11:32













i want sql query . I know the default way.

– Nitin Pawar
Dec 21 '16 at 11:33





i want sql query . I know the default way.

– Nitin Pawar
Dec 21 '16 at 11:33













why do you want using SQL query?

– chirag
Dec 21 '16 at 11:42






why do you want using SQL query?

– chirag
Dec 21 '16 at 11:42














I want to access the product names outside magento without using api.

– Nitin Pawar
Dec 21 '16 at 11:43





I want to access the product names outside magento without using api.

– Nitin Pawar
Dec 21 '16 at 11:43










4 Answers
4






active

oldest

votes


















10














Magento uses an EAV table structure for products. Names are stored in catalog_product_entity_varchar. If you have the product ID X, you can query this table directly:



SELECT entity_id, value, store_id FROM catalog_product_entity_varchar
WHERE entity_id = X AND attribute_id = (
SELECT attribute_id FROM eav_attribute
WHERE entity_type_id=4 AND attribute_code='name'
)


The subquery determines the attribute id for "name", entity_type_id 4 is always the type ID for products.



Note that in a multistore setup you might get multiple values per product. Pay attention to the "store_id" column. "0" stands for the default value.






share|improve this answer






























    1














    Use below query to find name from product_id




    SELECT value FROM catalog_product_entity_varchar WHERE entity_id=2
    AND (attribute_id IN(SELECT attribute_id FROM eav_attribute WHERE
    attribute_code = "name" AND entity_type_id = 4))




    Change entity_id=2 as per your product id






    share|improve this answer






























      1














      If your product's id is 1234:



      select value from catalog_product_entity_varchar left join eav_attribute on
      eav_attribute.attribute_id = catalog_product_entity_varchar.attribute_id
      where
      eav_attribute.attribute_code='name' and
      catalog_product_entity_varchar.entity_id=1234





      share|improve this answer

























      • there is no row_id column, use entity_id instead of row_id.

        – chirag
        Dec 21 '16 at 12:04











      • In Magento 2 you have row_id

        – Phoenix128_RiccardoT
        Dec 21 '16 at 12:21











      • what? can you share screenshot of your database table?

        – chirag
        Dec 21 '16 at 12:21











      • Magento EE has row_id.

        – nikola99
        Feb 1 '17 at 0:03


















      0














      Or you can try this also,for single record, X is your product_id you have to replace it by your own product id.



      SELECT DISTINCT value FROM catalog_product_entity_varchar WHERE entity_id=X AND (attribute_id IN(SELECT attribute_id FROM eav_attribute WHERE attribute_code = "name" AND entity_type_id = 4))





      share|improve this answer








      New contributor



      suraj dakre is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.



















        Your Answer








        StackExchange.ready(function()
        var channelOptions =
        tags: "".split(" "),
        id: "479"
        ;
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function()
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled)
        StackExchange.using("snippets", function()
        createEditor();
        );

        else
        createEditor();

        );

        function createEditor()
        StackExchange.prepareEditor(
        heartbeatType: 'answer',
        autoActivateHeartbeat: false,
        convertImagesToLinks: false,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: null,
        bindNavPrevention: true,
        postfix: "",
        imageUploader:
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        ,
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        );



        );













        draft saved

        draft discarded


















        StackExchange.ready(
        function ()
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f151303%2fmagento-2-how-to-get-product-name-by-sql-query-using-product-id%23new-answer', 'question_page');

        );

        Post as a guest















        Required, but never shown

























        4 Answers
        4






        active

        oldest

        votes








        4 Answers
        4






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        10














        Magento uses an EAV table structure for products. Names are stored in catalog_product_entity_varchar. If you have the product ID X, you can query this table directly:



        SELECT entity_id, value, store_id FROM catalog_product_entity_varchar
        WHERE entity_id = X AND attribute_id = (
        SELECT attribute_id FROM eav_attribute
        WHERE entity_type_id=4 AND attribute_code='name'
        )


        The subquery determines the attribute id for "name", entity_type_id 4 is always the type ID for products.



        Note that in a multistore setup you might get multiple values per product. Pay attention to the "store_id" column. "0" stands for the default value.






        share|improve this answer



























          10














          Magento uses an EAV table structure for products. Names are stored in catalog_product_entity_varchar. If you have the product ID X, you can query this table directly:



          SELECT entity_id, value, store_id FROM catalog_product_entity_varchar
          WHERE entity_id = X AND attribute_id = (
          SELECT attribute_id FROM eav_attribute
          WHERE entity_type_id=4 AND attribute_code='name'
          )


          The subquery determines the attribute id for "name", entity_type_id 4 is always the type ID for products.



          Note that in a multistore setup you might get multiple values per product. Pay attention to the "store_id" column. "0" stands for the default value.






          share|improve this answer

























            10












            10








            10







            Magento uses an EAV table structure for products. Names are stored in catalog_product_entity_varchar. If you have the product ID X, you can query this table directly:



            SELECT entity_id, value, store_id FROM catalog_product_entity_varchar
            WHERE entity_id = X AND attribute_id = (
            SELECT attribute_id FROM eav_attribute
            WHERE entity_type_id=4 AND attribute_code='name'
            )


            The subquery determines the attribute id for "name", entity_type_id 4 is always the type ID for products.



            Note that in a multistore setup you might get multiple values per product. Pay attention to the "store_id" column. "0" stands for the default value.






            share|improve this answer













            Magento uses an EAV table structure for products. Names are stored in catalog_product_entity_varchar. If you have the product ID X, you can query this table directly:



            SELECT entity_id, value, store_id FROM catalog_product_entity_varchar
            WHERE entity_id = X AND attribute_id = (
            SELECT attribute_id FROM eav_attribute
            WHERE entity_type_id=4 AND attribute_code='name'
            )


            The subquery determines the attribute id for "name", entity_type_id 4 is always the type ID for products.



            Note that in a multistore setup you might get multiple values per product. Pay attention to the "store_id" column. "0" stands for the default value.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Dec 21 '16 at 11:44









            Fabian SchmenglerFabian Schmengler

            55.2k21142356




            55.2k21142356























                1














                Use below query to find name from product_id




                SELECT value FROM catalog_product_entity_varchar WHERE entity_id=2
                AND (attribute_id IN(SELECT attribute_id FROM eav_attribute WHERE
                attribute_code = "name" AND entity_type_id = 4))




                Change entity_id=2 as per your product id






                share|improve this answer



























                  1














                  Use below query to find name from product_id




                  SELECT value FROM catalog_product_entity_varchar WHERE entity_id=2
                  AND (attribute_id IN(SELECT attribute_id FROM eav_attribute WHERE
                  attribute_code = "name" AND entity_type_id = 4))




                  Change entity_id=2 as per your product id






                  share|improve this answer

























                    1












                    1








                    1







                    Use below query to find name from product_id




                    SELECT value FROM catalog_product_entity_varchar WHERE entity_id=2
                    AND (attribute_id IN(SELECT attribute_id FROM eav_attribute WHERE
                    attribute_code = "name" AND entity_type_id = 4))




                    Change entity_id=2 as per your product id






                    share|improve this answer













                    Use below query to find name from product_id




                    SELECT value FROM catalog_product_entity_varchar WHERE entity_id=2
                    AND (attribute_id IN(SELECT attribute_id FROM eav_attribute WHERE
                    attribute_code = "name" AND entity_type_id = 4))




                    Change entity_id=2 as per your product id







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Dec 21 '16 at 11:47









                    Prashant ValandaPrashant Valanda

                    9,98212456




                    9,98212456





















                        1














                        If your product's id is 1234:



                        select value from catalog_product_entity_varchar left join eav_attribute on
                        eav_attribute.attribute_id = catalog_product_entity_varchar.attribute_id
                        where
                        eav_attribute.attribute_code='name' and
                        catalog_product_entity_varchar.entity_id=1234





                        share|improve this answer

























                        • there is no row_id column, use entity_id instead of row_id.

                          – chirag
                          Dec 21 '16 at 12:04











                        • In Magento 2 you have row_id

                          – Phoenix128_RiccardoT
                          Dec 21 '16 at 12:21











                        • what? can you share screenshot of your database table?

                          – chirag
                          Dec 21 '16 at 12:21











                        • Magento EE has row_id.

                          – nikola99
                          Feb 1 '17 at 0:03















                        1














                        If your product's id is 1234:



                        select value from catalog_product_entity_varchar left join eav_attribute on
                        eav_attribute.attribute_id = catalog_product_entity_varchar.attribute_id
                        where
                        eav_attribute.attribute_code='name' and
                        catalog_product_entity_varchar.entity_id=1234





                        share|improve this answer

























                        • there is no row_id column, use entity_id instead of row_id.

                          – chirag
                          Dec 21 '16 at 12:04











                        • In Magento 2 you have row_id

                          – Phoenix128_RiccardoT
                          Dec 21 '16 at 12:21











                        • what? can you share screenshot of your database table?

                          – chirag
                          Dec 21 '16 at 12:21











                        • Magento EE has row_id.

                          – nikola99
                          Feb 1 '17 at 0:03













                        1












                        1








                        1







                        If your product's id is 1234:



                        select value from catalog_product_entity_varchar left join eav_attribute on
                        eav_attribute.attribute_id = catalog_product_entity_varchar.attribute_id
                        where
                        eav_attribute.attribute_code='name' and
                        catalog_product_entity_varchar.entity_id=1234





                        share|improve this answer















                        If your product's id is 1234:



                        select value from catalog_product_entity_varchar left join eav_attribute on
                        eav_attribute.attribute_id = catalog_product_entity_varchar.attribute_id
                        where
                        eav_attribute.attribute_code='name' and
                        catalog_product_entity_varchar.entity_id=1234






                        share|improve this answer














                        share|improve this answer



                        share|improve this answer








                        edited Dec 21 '16 at 12:17









                        chirag

                        2,1351830




                        2,1351830










                        answered Dec 21 '16 at 11:49









                        Phoenix128_RiccardoTPhoenix128_RiccardoT

                        5,34121231




                        5,34121231












                        • there is no row_id column, use entity_id instead of row_id.

                          – chirag
                          Dec 21 '16 at 12:04











                        • In Magento 2 you have row_id

                          – Phoenix128_RiccardoT
                          Dec 21 '16 at 12:21











                        • what? can you share screenshot of your database table?

                          – chirag
                          Dec 21 '16 at 12:21











                        • Magento EE has row_id.

                          – nikola99
                          Feb 1 '17 at 0:03

















                        • there is no row_id column, use entity_id instead of row_id.

                          – chirag
                          Dec 21 '16 at 12:04











                        • In Magento 2 you have row_id

                          – Phoenix128_RiccardoT
                          Dec 21 '16 at 12:21











                        • what? can you share screenshot of your database table?

                          – chirag
                          Dec 21 '16 at 12:21











                        • Magento EE has row_id.

                          – nikola99
                          Feb 1 '17 at 0:03
















                        there is no row_id column, use entity_id instead of row_id.

                        – chirag
                        Dec 21 '16 at 12:04





                        there is no row_id column, use entity_id instead of row_id.

                        – chirag
                        Dec 21 '16 at 12:04













                        In Magento 2 you have row_id

                        – Phoenix128_RiccardoT
                        Dec 21 '16 at 12:21





                        In Magento 2 you have row_id

                        – Phoenix128_RiccardoT
                        Dec 21 '16 at 12:21













                        what? can you share screenshot of your database table?

                        – chirag
                        Dec 21 '16 at 12:21





                        what? can you share screenshot of your database table?

                        – chirag
                        Dec 21 '16 at 12:21













                        Magento EE has row_id.

                        – nikola99
                        Feb 1 '17 at 0:03





                        Magento EE has row_id.

                        – nikola99
                        Feb 1 '17 at 0:03











                        0














                        Or you can try this also,for single record, X is your product_id you have to replace it by your own product id.



                        SELECT DISTINCT value FROM catalog_product_entity_varchar WHERE entity_id=X AND (attribute_id IN(SELECT attribute_id FROM eav_attribute WHERE attribute_code = "name" AND entity_type_id = 4))





                        share|improve this answer








                        New contributor



                        suraj dakre is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                        Check out our Code of Conduct.























                          0














                          Or you can try this also,for single record, X is your product_id you have to replace it by your own product id.



                          SELECT DISTINCT value FROM catalog_product_entity_varchar WHERE entity_id=X AND (attribute_id IN(SELECT attribute_id FROM eav_attribute WHERE attribute_code = "name" AND entity_type_id = 4))





                          share|improve this answer








                          New contributor



                          suraj dakre is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.





















                            0












                            0








                            0







                            Or you can try this also,for single record, X is your product_id you have to replace it by your own product id.



                            SELECT DISTINCT value FROM catalog_product_entity_varchar WHERE entity_id=X AND (attribute_id IN(SELECT attribute_id FROM eav_attribute WHERE attribute_code = "name" AND entity_type_id = 4))





                            share|improve this answer








                            New contributor



                            suraj dakre is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                            Check out our Code of Conduct.









                            Or you can try this also,for single record, X is your product_id you have to replace it by your own product id.



                            SELECT DISTINCT value FROM catalog_product_entity_varchar WHERE entity_id=X AND (attribute_id IN(SELECT attribute_id FROM eav_attribute WHERE attribute_code = "name" AND entity_type_id = 4))






                            share|improve this answer








                            New contributor



                            suraj dakre is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                            Check out our Code of Conduct.








                            share|improve this answer



                            share|improve this answer






                            New contributor



                            suraj dakre is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                            Check out our Code of Conduct.








                            answered May 25 at 5:14









                            suraj dakresuraj dakre

                            1




                            1




                            New contributor



                            suraj dakre is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                            Check out our Code of Conduct.




                            New contributor




                            suraj dakre is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                            Check out our Code of Conduct.





























                                draft saved

                                draft discarded
















































                                Thanks for contributing an answer to Magento Stack Exchange!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid


                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.

                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function ()
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f151303%2fmagento-2-how-to-get-product-name-by-sql-query-using-product-id%23new-answer', 'question_page');

                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

                                Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

                                Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form