You have access to a MySQL 5.6 database with the SELECT ,INSERT, and DELETE
privileges on all tables in the mydb database.
The mydb database.
The mydb t1 table has five rows of data.
You use the statement below to remove all rows in the t1 table:
Mysql> TRUNCATE TABLE mysql.t1;
What is the result?
A.
The command succeeds and o rows are affected.
B.
The command succeeds and five rows are affected.
C.
The command fails owing to syntax error.
D.
The command fails owing to permissions error.
correct is D, you don’t have Drop and Create permissions
Answer is A.
From MySQL 5.0 Certification Study Guide by Dubois, Hinz, and Pedersen:
“Whereas TRUNCATE TABLES always removes all records.”
…Nothing about create (thats the replace statement which require the INSERT & DELETE… which the person has).
“TRUNCATE TABLE is like DELETE in that it deletes records, so it requires the DELETE privilege.”
… since you have the delete privilege, you got the truncate privilege.
It’s D
I was wrong… or more that I am reading out of date material.
https://dev.mysql.com/doc/refman/5.6/en/truncate-table.html
TRUNCATE TABLE empties a table completely. It requires the DROP privilege.
D
yep, D.
http://dev.mysql.com/doc/refman/5.7/en/truncate-table.html
Although TRUNCATE TABLE is similar to DELETE, it is classified as a DDL statement rather than a DML statement. It differs from DELETE in the following ways in MySQL 5.7:
surely D