SUM function in MariaDB

MariaDB SUM To get the summed value of an expression, the MariaDB SUM function is used. Syntax 1: SELECT expressions, SUM (aggregate_expression) FROM table_name WHERE conditions; Syntax 2: To calculate SUM and grouping the results by one or more columns. SELECT expression1, expression2, … expression_n, SUM(aggregate_expression) FROM tables WHERE conditions GROUP BY expression1, expression2, … … Read more

FROM clause in MariaDB

MariaDB FROM MariaDB FROM clause is used to specify the tables from which the records needs to be retrieved. It thus has a mandatory existence with the MariaDB SELECT statement. Syntax: To select all fields from a table. SELECT * FROM table_name; Example: Selecting all fields from a table. SELECT * FROM Players;SELECT * FROM … Read more

DISTINCT clause in MariaDB

MariaDB DISTINCT The MariaDB DISTINCT clause is used with the SELECT statement to eliminate the duplicate records from the result set. Syntax: SELECT DISTINCT columns FROM tables WHERE conditions; Parameters: conditions: It is used to specify the conditions to be strictly fulfilled for the selection. Example 1: Using Distinct Select for single column. Players table: … Read more

ORDER BY in MariaDB

MariaDB ORDER BY MariaDB ORDER BY clause is used with the MariaDB SELECT statement to sort or re-arrange the records in the result set. Syntax: SELECT expressions FROM table_name WHERE conditions; ORDER BY expression [ ASC | DESC ]; Parameters: ASC: It is an optional parameter which is used to specify the sorting order to … Read more

LIKE Operator in MariaDB

MariaDB LIKE To filter the results, the MariaDB LIKE condition is used with a combination of WHERE Clause in SELECT, INSERT, UPDATE and DELETE statements to perform pattern matching. Syntax: WHERE expressions LIKE pattern [ ESCAPE ‘escape_character’ ] Parameters: expressions: It is used to specify a column or a field. pattern: It is used to … Read more

WHERE clause in MariaDB

MariaDB WHERE To filter the results, the MariaDB WHERE clause is used with SELECT, INSERT, UPDATE and DELETE statements. Syntax: WHERE conditions;WHERE conditions; Parameters: conditions: It is used to specify the conditions to be strictly followed for selection. Example: Selecting specific fields from a table. Students table: ID NAME AGE 1 Joy 5 2 Smiley … Read more

TRUNCATE TABLE in MariaDB

TRUNCATE TABLE To delete all records of a table such that the table cannot be rolled back, the MariaDB TRUNCATE TABLE statement is used. It is much similar to the DELETE TABLE statement without a WHERE clause. Syntax: TRUNCATE TABLE database_name.table_name Parameters: database_name: It is used to specify the name of the database to select. … Read more

DELETE Query in MariaDB

MariaDB DELETE To remove or delete a single record or multiple records from a table, MariaDB DELETE statement is used. Syntax: To delete all rows from a table. DELETE FROM table_name Syntax: To delete specific rows from a table. DELETE FROM table_name WHERE conditions; Parameters: table_name: It is used to specify the name of the … Read more

UPDATE Query in MariaDB

MariaDB UPDATE To modify the existing records in a table by changing their values, the MariaDB UPDATE statement is used. Syntax: UPDATE table_name SET column_1 = value_1, column_2 = value_2, … column_n = value_n WHERE conditions; Parameters: value_1, value_2, … value_n: It is used to specify the values to be updated to the respective columns. … Read more

SELECT LIMIT in MariaDB

MariaDB SELECT LIMIT To fetch limited records from the tables stored in the database, the MariaDB SELECT statement is used with LIMIT clause. Syntax: SELECT columns FROM table_name WHERE conditions ORDER BY expression [ ASC | DESC ] LIMIT row_count; Parameters: columns: It is used to specify the columns or calculations to be retrieved. table_name: … Read more