Author: Awais Khan

  • Union

    MySQL Union is an operator that allows us to combine two or more results from multiple SELECT queries into a single result set. It comes with a default feature that removes the duplicate rows from the result set. MySQL always uses the name of the column in the first SELECT statement will be the column names of…

  • Window Functions

    A window function in MySQL used to do a calculation across a set of rows that are related to the current row. The current row is that row for which function evaluation occurs. Window functions perform a calculation similar to a calculation done by using the aggregate functions. But, unlike aggregate functions that perform operations on…

  • Ranking Functions

    MySQL uses a ranking function that allows us to rank each row of a partition in the databases. The ranking functions are also a sub-part of a window function in MySQL. The ranking functions in MySQL can be used with the following clauses: NOTE: It is to be noted that MySQL provides support for the ranking and…

  • Number Format Function

    FORMAT function in MySQL is used to formats the number as a format of “#, ###. ##”, rounded it in certain decimal places. After formatting the number, it will return the value as a string. This function is beneficial when we calculate values in the databases like inventory turnover, or the average net price of products.…

  • SIGNAL RESIGNAL

    This article will cover how to use SIGNAL and RESIGNAL statements for raising error conditions inside stored programs. MySQL SIGNAL Statement The SIGNAL query is a mechanism used to return a warning or error message appearing during the execution of a stored program, such as stored procedure, trigger or event, or stored function. This statement provides error…

  • Stored Function

    A stored function in MySQL is a set of SQL statements that perform some task/operation and return a single value. It is one of the types of stored programs in MySQL. When you will create a stored function, make sure that you have a CREATE ROUTINE database privilege. Generally, we used this function to encapsulate…

  • Limit

    MySQL Limit query is used to restrict the number of rows returns from the result set, rather than fetching the whole set in the MySQL database. The Limit clause works with the SELECT statement for returning the specified number of rows only. This query accepts only one or two arguments, and their values should be zero or any positive…

  • Cursor

    In MySQL, Cursor can also be created. Following are the steps for creating a cursor. 1. Declare Cursor A cursor is a select statement, defined in the declaration section in MySQL. Syntax Parameter: cursor_name: name of the cursor select_statement: select query associated with the cursor 2. Open Cursor After declaring the cursor the next step is to open…

  • ROW_NUMBER() Function

    The ROW_NUMBER() function in MySQL is used to returns the sequential number for each row within its partition. It is a kind of window function. The row number starts from 1 to the number of rows present in the partition. It is to be noted that MySQL does not support the ROW_NUMBER() function before version 8.0, but…

  • What is partitioning in MySQL?

    Partitioning in MySQL is used to split or partition the rows of a table into separate tables in different locations, but still, it is treated as a single table. It distributes the portions of the table’s data across a file system based on the rules we have set as our requirement. The rule that we…