Solution:NIIT/GNIIT Sonugiri0032@gmail.com

Monday, March 12, 2018

MariaDB Interview Questions

1) What is MariaDB?

MariaDB is a popular open source and community based project developed by MySQL developers. It is a relational database management technology which provides same features of MySQL. It is a new replacement of MySQL.


2) What are the main features of MariaDB?

Following is a list of features of MariaDB:
  • MariaDB can run on different operating systems and support a wide variety of programming language.
  • MariaDB follows a standard and popular querying language.
  • MariaDB provides Galera cluster technology.
  • MariaDB provides supports for PHP which is the most popular web development language.


3) How to create database in MariaDB?

CREATE DATBASE command is used to create database in MariaDB.
Syntax:
  1. CREATE DATABASE Database_name;   


4) How to use database in MariaDB?

USE DATABASE command is used to select and use a database in MariaDB.
Syntax:
  1. USE database_name;         

5) How to delete a database in MariaDB ?

DROP DATABASE command is used to drop a database in MariaDB.
Syntax:
  1. DROP DATABASE Database_name;     


6) How to create a table in MariaDB's database?

First, you have to create a database in MariaDB follows by selecting the database and then create a table by using CREATE TABLE statement.
Syntax:
  1. CREATE TABLE table_name (column_name column_type);     


7) How to delete a table in MariaDB's database?

DROP TABLE command is used to delete a table from a database in MariaDB. It deletes the table permanently and cannot be recovered.
Syntax:
  1. DROP TABLE table_name ;      


8) How to insert records in a table in MariaDB database?

INSERT INTO statement is used to insert records in a table in MariaDB database.
Syntax:
  1. INSERT INTO tablename (field,field2,...) VALUES (value, value2,...);     


9) How to retrieve records from a table in MongoDB database?

SELECT statement is used to retrieve records from a table in MongoDB database. You can choose, single, multiple or all records from a table by using different keywords.
Syntax:
  1. SELECT expressions    
  2. FROM tables    
  3. [WHERE conditions];   

10) How can you retrieve limited number of records from a table?

LIMIT clause is used with SELECT statement to select a limited number of records from a table. It facilitates you to retrieve records according to your use.
Syntax:
  1.  SELECT expressions    
  2. FROM tables    
  3. [WHERE conditions]    
  4. [ORDER BY expression [ ASC | DESC ]]    
  5. LIMIT row_count;   


11) How can you change or update the already inserted records of a MariaDB table?

UPDATE statement is used to change, update or modify the existing records of a MariaDB table. It can be used with WHERE, OBDER BY and LIMIT clauses.
Syntax:
  1. UPDATE table_name SET field=new_value, field2=new_value2,...    
  2. [WHERE ...]      


12) What is the use of DELETE statement in MariaDB?

The MariaDB DELETE statement is used to delete one or more records from the table in the database. It can be used to delete records from the table as well the whole table if you use it without WHERE condition.
Syntax:
  1. DELETE FROM table    
  2. [WHERE conditions]    
  3. [ORDER BY expression [ ASC | DESC ]]    
  4. [LIMIT number_rows];      


13) What is the use of TRUNCATE statement? How is it different from DELETE statement?

TRUNCATE TABLE statement is used to delete a table permanently. It deletes all the records from the table.
Syntax:
  1. TRUNCATE [TABLE] [database_name.]table_name;      
Difference between DELETE and TRUNCATE statement:
  • DELETE statement is used to remove one or more columns from a table as well as whole table. On the other hand, TRUNCATE TABLE statement is used to delete the whole table permanently.
  • TRUNCATE TABLE statement is same as DELETE statement without a WHERE clause.


14) What is an aggregate function? How many types of aggregate functions in MariaDB?

In relational database management system, aggregate functions are the functions where the values of multiple rows are grouped together as input on certain criteria and provide a single value of more significant meaning such as a list, set etc.
Following is a list of aggregate function in MariaDB:
  • MariaDB COUNT Function
  • MariaDB SUM Function
  • MariaDB MIN Function
  • MariaDB MAX Function
  • MariaDB AVG Function

15) What are the different types of clauses used in MariaDB?

MariaDB supports all clauses used in RDBMS. For example:
  • MariaDB Where Clause
  • MariaDB Like Clause
  • MariaDB Order By Clause
  • MariaDB DISTINCT Clause
  • MariaDB FROM Clause
  • Etc.

16) What is the use of WHERE clause?

WHERE clause is used to select or change a specific location to fetch the records from a table. It is used with SELECT, INSERT, UPDATE and DELETE statement.
Syntax:
  1. [COMMAND] field,field2,... FROM table_name,table_name2,... WHERE [CONDITION]      

17) What is the use of LIKE clause in MariaDB?

MariaDB LIKE clause is used with SELECT, INSERT, UPDATE and DELETE statement to retrieve data when an operation needs an exact match.
Syntax:
  1. SELECT field, field2,... FROM table_name, table_name2,...    
  2. WHERE field LIKE condition     

18) What is the use of ORDER BY clause in MariaDB?

MariaDB ORDER BY Clause is used to sort the records in your result set in ascending or descending order.
Syntax:
  1. SELECT expressions    
  2. FROM tables    
  3. [WHERE conditions]    
  4. ORDER BY expression [ ASC | DESC ];      


19) What is the use of MariaDB DISTINCT clause?

MariaDB DISTINCT Clause is used to remove duplicates from the result when it is used with SELECT statement.
Syntax:
  1. SELECT DISTINCT expressions    
  2. FROM tables    
  3. [WHERE conditions];     


20) Why do we use FROM clause with SELECT statement?

FROM clause is used with SELECT statement to retrieve data from the table. It is also used to join tables.
Syntax:
  1. SELECT columns_names FROM table_name;      


21) What is the use of COUNT() aggregate function?

MariaDB COUNT() aggregate function is used to return the count of an expression.
Syntax:
  1. SELECT COUNT(aggregate_expression)    
  2. FROM tables    
  3. [WHERE conditions];     


22) What is the use of MariaDB SUM() function?

MariaDB SUM function is used to return the summed value of an expression.
Syntax:
  1. SELECT SUM(aggregate_expression)    
  2. FROM tables    
  3. [WHERE conditions];   


23) What is the usage of MIN() function in MariaDB?

MariaDB MIN() functiuon is used to retrieve the minimum value of the expression.
Syntax:
  1. SELECT MIN(aggregate_expression)    
  2. FROM tables    
  3. [WHERE conditions];       


24) What is the usage of MAX() function in MariaDB?

MariaDB MAX() function is used to retrieve the maximum value of the expression.
Syntax:
  1. SELECT MAX(aggregate_expression)    
  2. FROM tables    
  3. [WHERE conditions];   

25) What is the usage of AVG() function in MariaDB database?

MariaDB AVG() function is used to retrieve the average value of an expression.
Syntax:
  1. SELECT AVG(aggregate_expression)    
  2. FROM tables    
  3. [WHERE conditions];      


26) What is JOIN? How many types of JOIN in MariaDB?

JOIN is used to retrieve data from two or more tables. By default JOIN is also called INNER JOIN. It is used with SELECT statement.
There are mainly two types of joins in MariaDB:
  • INNER JOIN
  • OUTER JOIN
Again OUTER JOIN is divided in two types:
  • LEFT JOIN
  • RIGHT JOIN

27) What is MariaDB INNER JOIN?

MariaDB INNER JOIN is the most common type of join which returns all rows from multiple tables where the join condition is satisfied.
Syntax:
  1. SELECT columns    
  2. FROM table1     
  3. INNER JOIN table2    
  4. ON table1.column = table2.column;    


28) What is LEFT OUTER JOIN in MariaDB?

MariaDB LEFT OUTER JOIN is used to return all rows from left-hand table specified in the ON condition and only those rows from the other table where the joined condition is satisfied.
LEFT OUTER JOIN is also called LEFT JOIN.
Syntax:
  1. SELECT columns    
  2. FROM table1    
  3. LEFT [OUTERJOIN table2    
  4. ON table1.column = table2.column;     


29) What is RIGHT OUTER JOIN in MariaDB?

MariaDB RIGHT OUTER JOIN is used to return all rows from right-hand table specified in the ON condition and only those rows from the other table where the joined fields are satisfied the conditions.
MariaDB RIGHT OUTER JOIN is also called RIGHT JOIN.
Syntax:
  1. SELECT columns    
  2. FROM table1    
  3. RIGHT [OUTERJOIN table2    
  4. ON table1.column = table2.column;  


30) What is function in MariaDB? How can you create and drop function in MariaDB?

MariaDB function is a stored program that is used to pass parameters into them and return a value.
We can easily create and drop functions in MariaDB.

31) What is a procedure or a stored procedure in database?

Procedures are sort of functions in a database. Procedures are created when you want to perform a task repetitively.
MariaDB procedure is a stored program that is used to pass parameters into it. It does not return a value like a function does.
You can create and drop procedures like functions.
Share:

0 comments:

GNIITSOLUTION GNIIT SOLUTION. Powered by Blogger.

Translate

Blog Archive

Unordered List