-
What is the purpose of the NOW() function in MySQL?
- A) To return the current date and time
- B) To return the current date
- C) To return the current time
- D) To return the current year
Answer: A) To return the current date and time
-
Which SQL command is used to revoke specific privileges from a user in MySQL?
- A) REMOVE PRIVILEGES
- B) REVOKE
- C) DENY
- D) WITHDRAW
Answer: B) REVOKE
-
What is the purpose of the CASCADE keyword in MySQL?
- A) To specify the action to perform when a foreign key constraint is violated
- B) To specify the action to perform when a primary key constraint is violated
- C) To specify the action to perform when a column is updated
- D) To specify the action to perform when a column is deleted
Answer: A) To specify the action to perform when a foreign key constraint is violated
-
Which SQL function is used to return the current date in MySQL?
- A) CURRENT_DATE()
- B) NOW()
- C) GETDATE()
- D) CURDATE()
Answer: A) CURRENT_DATE()
-
What is the purpose of the TRUNCATE TABLE statement in MySQL?
- A) To delete all rows from a table
- B) To delete a specific row from a table
- C) To delete a specific column from a table
- D) To delete the structure of a table
Answer: A) To delete all rows from a table
-
Which SQL command is used to update the structure of a table in MySQL?
- A) ALTER TABLE
- B) UPDATE TABLE
- C) MODIFY TABLE
- D) CHANGE TABLE
Answer: A) ALTER TABLE
-
What is the purpose of the INNER JOIN in MySQL?
- A) To combine rows from two or more tables based on a related column
- B) To retrieve all records from the left table and matching records from the right table
- C) To retrieve all records from the left table and matching records from the right table, including non-matching records
- D) To retrieve all records from the left table and matching records from the right table, excluding non-matching records
Answer: A) To combine rows from two or more tables based on a related column
-
Which SQL function is used to return the length of a string in MySQL?
- A) LENGTH()
- B) CHAR_LENGTH()
- C) STRLEN()
- D) STRING_LENGTH()
Answer: B) CHAR_LENGTH()
-
What is the purpose of the LIMIT clause in conjunction with the OFFSET clause in MySQL?
- A) To specify the number of rows to retrieve in the result set
- B) To specify the starting row from which to retrieve rows in the result set
- C) To filter rows based on a specified condition
- D) To combine rows from two or more tables
Answer: B) To specify the starting row from which to retrieve rows in the result set
-
Which SQL command is used to delete a specific row from a table in MySQL?
- A) DELETE ROW
- B) REMOVE ROW
- C) DROP ROW
- D) DELETE FROM
Answer: D) DELETE FROM
Comments