In the following MySQL command how many rows will be deleted?
DELETE person
WHERE person_id=1;
/*person_id is a primary key */
DELETE person
WHERE person_id=1;
/*person_id is a primary key */
A. 1
B. 0
C. No row
D. None of the mentioned
Answer: Option A
Solution (By Examveda Team)
This question is about how MySQL deletes data using the DELETE command.Let's break down the command:
DELETE person: This tells MySQL to delete rows from the table named "person."
WHERE person_id=1: This specifies a condition. It tells MySQL to delete only the row(s) where the column "person_id" has the value "1."
Since person_id is a primary key, it means each row in the table has a unique value for "person_id". This ensures that there can only be one row with "person_id=1".
Therefore, the command will delete exactly one row.
So the correct answer is Option A: 1
Related Questions on MySQL Miscellaneous
How is communication established with MySQL?
A. SQL
B. Network calls
C. A programming language like C++
D. APIs
Which type of database management system is MySQL?
A. Object-oriented
B. Hierarchical
C. Relational
D. Network
Join The Discussion