Find entries that use a specific block in their Matrix field? Suppose a Mtrix field named MyMatrixField has three blocks called Text, Images, and Buttons.

What MySQL query would list the section and title for all entries whose MyMatrixField field has a Buttons block in-use?

Something like:

SELECT section, title FROM `craft_entries` WHERE `field_MyMatrixField_Buttons` IS NOT NULL
You can join your matrix table and check for elements with a certain type and your owner id

{% set entries = craft
    .entries()
    .section(['your-section'])
    .leftJoin('{{%matrixblocks}} as matrixblocks', 'matrixblocks.ownerId = entries.id')
    .andWhere({'matrixblocks.typeId': 1}) 
    .all()
%}


replace the correct section and the correct type id of your blocktype