Author: Awais Khan
-
Export and Import Database
How can we Export and Import database in MySQL? Database export and import in MySQL is a process of moving data from one place to another place. Export and import are useful methods for backing up essential data or transferring our data between different versions. For example, we have a contact book database that is…
-
Change Storage Engine
MySQL storage engines are used for maximizing the performance of the database. It handles create, read, and update operations for storing and managing the information in a database. In this article, we are going to learn how to change the storage engines in MySQL. The following are various storage engines supports in MySQL that provide different capabilities and…
-
CHECK CONSTRAINT
The check constraint is an integrity constraint that controls the value in a particular column. It ensures the inserted or updated value in a column must be matched with the given condition. In other words, it determines whether the value associated with the column is valid or not with the given condition. Before version 8.0.16, MySQL uses…
-
Comments
A comment is a programmer-readable explanation or annotation placed in the SQL queries. It is used for the purpose of making the SQL statements easier for humans to understand. MySQL generally ignores them during the parsing of the SQL code. Comments can be written in a single line or multiple lines. MySQL can also provide an…
-
last function
MySQL last function is used to return the last value of the selected column. Syntax: MySQL last function example Consider a table “officers” having the following data. Execute the following query: This query will return the last officer_name ordering by officer_id. Output: Return the last officer_name ordering by officer_name: Output:
-
first function
The MySQL first function is used to return the first value of the selected column. Here, we use limit clause to select first record or more. Syntax: MySQL first function example To SELECT FIRST element: Consider a table named “officers”, having the following data. Execute the following query: Output: To SELECT FIRST two records Output:
-
GROUP_CONCAT() Function
The GROUP_CONCAT() function in MySQL is a type of an aggregate function. This function is used to concatenate string from multiple rows into a single string using various clauses. If the group contains at least one non-null value, it always returns a string value. Otherwise, you will get a null value. The following are the…
-
MAX() Function
The MySQL MAX() function is used to return the maximum value in a set of values of an expression. This aggregate function is useful when we need to find the maximum number, selecting the most expensive product, or getting the largest payment to the customer from your table. Syntax The following is the basic syntax…
-
MIN() Function
The MIN() function in MySQL is used to return the minimum value in a set of values from the table. It is an aggregate function that is useful when we need to find the smallest number, selecting the least expensive product, etc. Syntax The following is the basic syntax of MIN() function in MySQL: Parameter explanation This function…
-
avg() function
The MySQL avg() is an aggregate function used to return the average value of an expression in various records. Syntax The following are the basic syntax an avg() function in MySQL: Parameter explanation aggregate_expression: It specifies the column or expression that we are going to find the average result. table_name: It specifies the tables from where we…