Q
Which of the following SQL operations is used to remove all data from a database table?

Answer & Solution

Answer: Option C
Solution:
The TRUNCATE operation in SQL is used to remove all data from a database table by deleting all rows. Unlike the DELETE operation, which removes specific rows, TRUNCATE removes all rows from the table.
Related Questions on Average

What is the purpose of the mysqli_num_rows() function in PHP?

A). Establishing a database connection

B). Executing SQL queries

C). Fetching data from the database

D). Getting the number of rows in a result set

Which PHP extension provides procedural and object-oriented approaches for executing SQL queries and interacting with MySQL databases?

A). PDO

B). MySQL

C). SQLI

D). MySQLi

Which of the following PHP functions is used to execute an SQL query in MySQLi extension?

A). mysqli_execute()

B). mysqli_query()

C). mysqli_fetch()

D). mysqli_prepare()

Which PHP extension is commonly used for executing SQL queries and interacting with databases?

A). MySQL

B). PDO

C). SQLI

D). PHPDB

Which of the following PHP functions is used to get the number of rows affected by an SQL query in MySQLi extension?

A). mysqli_num_rows()

B). mysqli_affected_rows()

C). mysqli_num_fields()

D). mysqli_fetch_row()

What is the primary advantage of using prepared statements in PHP for executing SQL queries?

A). Better performance

B). Improved security against SQL injection

C). Easier syntax

D). Compatibility with older PHP versions

Which of the following SQL operations is used to insert new data into a database table?

A). INSERT

B). SELECT

C). UPDATE

D). DELETE

What is the primary function of the mysqli_fetch_array() function in PHP?

A). Establishing a database connection

B). Executing SQL queries

C). Fetching data from the database

D). Closing the database connection

What is the primary function of the mysqli_query() function in PHP?

A). Establishing a database connection

B). Executing SQL queries

C). Fetching data from the database

D). Closing the database connection

What is the primary purpose of the PDO::query() method in PHP PDO extension?

A). Establishing a database connection

B). Executing an SQL query

C). Fetching data from the database

D). Closing the database connection