MariaDB Interview Questions and Answers
Freshers / Beginner level questions & answers
Ques 1. Explain the purpose of the mysqldump command.
mysqldump is a command-line utility for creating backups of MySQL or MariaDB databases. It produces a SQL script that can be used to recreate the database structure and data.
Ques 2. What is the purpose of the MariaDB INFORMATION_SCHEMA database?
The INFORMATION_SCHEMA database in MariaDB contains metadata about the server and its databases. It provides information about tables, columns, indexes, and other aspects of the database system.
Ques 3. Explain the difference between a primary key and a unique key in MariaDB.
Both primary keys and unique keys in MariaDB enforce uniqueness, but a table can have only one primary key, while it can have multiple unique keys. Additionally, the primary key column(s) cannot contain NULL values, while unique key columns can have NULLs.
Ques 4. What is the purpose of the FOREIGN KEY constraint in MariaDB?
The FOREIGN KEY constraint in MariaDB ensures referential integrity by enforcing a link between two tables. It ensures that values in a column (or columns) of one table correspond to the values in another table's unique or primary key column(s).
Ques 5. What is the purpose of the ANALYZE TABLE statement in MariaDB?
The ANALYZE TABLE statement in MariaDB updates statistics about a table, which the query optimizer uses to make better decisions when generating execution plans. Running ANALYZE TABLE can improve the performance of queries, especially after significant data modifications.
Ques 6. What is the purpose of the TRUNCATE TABLE statement in MariaDB?
The TRUNCATE TABLE statement in MariaDB is used to quickly delete all rows from a table, effectively resetting the table to an empty state. It is faster than the DELETE statement for large tables but does not support conditions or triggers.
Ques 7. What is the purpose of the OPTIMIZE TABLE statement in MariaDB?
The OPTIMIZE TABLE statement in MariaDB is used to reclaim storage space and defragment a table. It is particularly useful after significant changes or deletions in a table, as it can improve performance by optimizing the table's physical storage layout.
Ques 8. What is the purpose of the TINYINT data type in MariaDB?
The TINYINT data type in MariaDB is used to store very small integer values, typically ranging from -128 to 127 (signed) or 0 to 255 (unsigned). It is space-efficient and is suitable for columns that store boolean or small numeric values.
Ques 9. What is the purpose of the SHOW command in MariaDB? Provide an example.
The SHOW command in MariaDB is used to display information about databases, tables, columns, and server settings. For example, 'SHOW DATABASES;' lists the available databases, and 'SHOW TABLES FROM database_name;' shows the tables in a specific database.
Most helpful rated by users: