Database and SQL Learning Mode
Given the following table called "names" ..
id | name | |
---|---|---|
1 | anna | anna@mail.com |
2 | betty | bettty@mail.com |
3 | clara | clara@mail.com |
4 | demi | demi@mail.com |
5 | emma | emma@mail.com |
6 | gabi | gabi@mail.com |
what will the count() value be when the following PHP code runs? (Assume PDO connection is valid)
$pdo = new PDO(...);
$sql = "select :cols from names where name = :name";
$stmt = $pdo->prepare($sql);
$stmt->bindValue(':cols', 'COUNT(id)');
$stmt->bindValue(':name', 'anna');
$stmt->execute();
|
|
|
|