function lowInventory() {
  var query = "SELECT * FROM products WHERE stock_quantity < 20";
  connection.query(query, function (err, res) {
    if (err) throw err;
    for (var i = 0; i < res.length; i++) {
      productInfo.push([
        res[i].item_id,
        res[i].product_name,
        res[i].author_artist,
        res[i].department_name,
        "$" + res[i].price,
        res[i].stock_quantity + " available",
      ]);
    }
    var rows = [
      ["ID", "Product", "Author/Artist", "Department", "Price", "Quantity"],
      ...productInfo
    ];
    // Prints the inventory in a table format.
    cli.print(
      cli.table(rows) + "\n"
    );
    productInfo = []
  });
}
// Show users all items that have a quantity of less than 20.
Show users all items that have a quantity of less than 20.
Show users all items that have a quantity of less than 20 .
function lowInventory() {
  var query = "SELECT * FROM products WHERE stock_quantity < 20";
  connection.query(query, function (err, res) {
    if (err) throw err;
    for (var i = 0; i < res.length; i++) {
      productInfo.push([
        res[i].item_id,
        res[i].product_name,
        res[i].author_artist,
        res[i].department_name,
        "$" + res[i].price,
        res[i].stock_quantity + " available",
      ]);
    }
    var rows = [
      ["ID", "Product", "Author/Artist", "Department", "Price", "Quantity"],
      ...productInfo
    ];
    cli.print(
      cli.table(rows) + "\n"
    );
    productInfo = []
  });
}
function lowInventory ( ) { var query = "SELECT * FROM products WHERE stock_quantity < 20" ; connection . query ( query , function ( err , res ) { if ( err ) throw err ; for ( var i = 0 ; i < res . length ; i ++ ) { productInfo . push ( [ res [ i ] . item_id , res [ i ] . product_name , res [ i ] . author_artist , res [ i ] . department_name , "$" + res [ i ] . price , res [ i ] . stock_quantity + " available" , ] ) ; } var rows = [ [ "ID" , "Product" , "Author/Artist" , "Department" , "Price" , "Quantity" ] , ... productInfo ] ; cli . print ( cli . table ( rows ) + "\n" ) ; productInfo = [ ] } ) ; }
Show users all items that have a quantity of less than 20.
Show users all items that have a quantity of less than 20 .
// Prints the inventory in a table format.