jquery
Retrieve the out-of-stock items in Magento 2, you can use the following SQL query
Queries for Product Stock and Status in Magento
Query to Get Out-of-Stock Items in Magento
SELECT
cpe.sku,
cpe.entity_id,
cpe.type_id,
cpe.attribute_set_id,
cisi.qty,
cisi.is_in_stock
FROM
catalog_product_entity AS cpe
JOIN
cataloginventory_stock_item AS cisi
ON cpe.entity_id = cisi.product_id
WHERE
cisi.is_in_stock = 0;
Query to Get Out-of-Stock Items That Are Enabled
Error after upgrading Magento to latest version
Sometime when you upgrade Magento to latest version you will have this error in the console