Examveda

What is the return value from operations returning a row count?

A. $rc

B. $rv

C. $rows

D. $ary

Answer: Option C

Solution (By Examveda Team)

This question is about how MySQL tells you how many rows were affected by an operation like inserting, updating, or deleting data.
Let's break down the options:
Option A: $rc - This is a common variable used to store the row count in many programming languages, but not in standard MySQL.
Option B: $rv - This is a variable often used for return values, but it's not specifically for row counts in MySQL.
Option C: $rows - This is a variable that might store rows, but it's not the standard way MySQL reports the number of affected rows.
Option D: $ary - This looks like a placeholder for an array and isn't related to row counts in MySQL.
The correct answer is none of the above. MySQL uses the ROW_COUNT() function to get the number of rows affected by the last statement.
For example, if you ran `DELETE FROM my_table WHERE id = 1;` and it deleted one row, then `SELECT ROW_COUNT();` would return `1`.
Key takeaway: MySQL uses `ROW_COUNT()` to find out how many rows were changed.

This Question Belongs to MySQL >> MySQL Miscellaneous

Join The Discussion

Related Questions on MySQL Miscellaneous