MySQL DATE_ADD() Function with Examples

How to Use the MySQL DATE_ADD() Function This tutorial explains how to use MySQL DATE_ADD() function, which adds a time or date interval to a given date and returns a new date. To subtract a time or date interval from a given time, use the DATE_SUB() function. MySQL DATE_ADD() Syntax The syntax of the DATE_ADD() … Read more

MySQL DATE_SUB() Function with Examples

How to Use the MySQL DATE_SUB() Function In this tutorial, you’ll learn how to use the MySQL DATE_SUB() function. The DATE_SUB() function subtracts a time and date interval from a given date and returns a new date. To add the date and time to a given date, use the DATE_ADD() function. MySQL DATE_SUB() Syntax The syntax of the DATE_SUB() … Read more

MySQL NULLIF Function with Examples

How to Use the MySQL NULLIFF() Function In this tutorial, you will learn how to use the MySQL NULLIF() function, which compares two expressions and returns NULL if equal; otherwise returns the first expression. MySQL NULLIF() Syntax The syntax of the NULLIF() function is as follow: NULLIF (expression_1, expression_2) NULLIF Examples Example 1 The following … Read more

MySQL LOCATE Function with Examples

How to Use the MySQL LOCATE Function This tutorial explains how to use the MySQL LOCATE function, which returns the position where the substring first appears in a given string. See also: MySQL COUNT() function MySQL SUM() function MySQL SUBSTRING() function MySQL LOCATE() Syntax The syntax of the LOCATE function is as follows: LOCATE(substring, string) … Read more

MySQL IFNULL() Function with Examples

How to Use the MySQL IFNULL() Function In this tutorial, you will learn how to use the MySQL IFNULL() function that returns the specified value if the expression is NULL; otherwise returns that expression. If you want to compare two expressions and return NULL if they are equal, use the NULLIF() function. IFNULL() Syntax The … Read more

MySQL CROSS JOIN with Examples

How to Use the MySQL CROSS JOIN In this tutorial, we’ll learn how to use the CROSS JOIN in MySQL. CROSS JOIN returns the Cartesian product of 2 tables, returning all possible combination of all records. For example, suppose we join the employees table, containing 4 records, and departments table, containing 3 records. Since CROSS … Read more

MySQL LOOP with Examples

How to Use the MySQL LOOP Statement In this tutorial, you will learn how to use a LOOP statement in MySQL. A LOOP statement is a simple loop construct that allows you to repeatedly execute a block of SQL code consisting of one or more SQL statements ending with a semicolon (;). There are two … Read more

MySQL ADD COLUMN Statement with Examples

How to Add Columns to a Table in MySQL In this tutorial, you will learn how to add columns to a MySQL table using the MySQL ADD COLUMN statement, which allows you to add single or multiple columns in a single MySQL statement. If you want to delete the existing columns, use the DELETE COLUMN … Read more

MySQL AVG() Function with Examples

How to Use the MySQL AVG() Function In this tutorial, we’ll learn how to use the AVG() function to calculate the average value of an expression in MySQL. MySQL AVG() Syntax The syntax of the AVG() function is as follows: AGV([DISTINCT] expression) Remarks The expression argument is required, and can be a column name or … Read more

MySQL CREATE USER – Add Users in MySQL

How to create a user account using the CREATE USER statement in MySQL with examples This tutorial explains how to create a user account in MySQL using the CREATE USER statement. It is possible to create a user account that can connect to the MySQL database server from localhost, a specified host, or any host. … Read more

MySQL INSTR Function with Examples

How to Use the MySQL INSTR Function In this tutorial, we’ll learn how to use the MySQL INSTR() function. INSTR() returns the position of the first occurrence of substring in a given string. MySQL INSTR Syntax The following is the syntax of the INSTR() function: INSTR(string, substring) Remark INSTR() returns 0 if substring or string … Read more

MySQL RENAME TABLE Statement with Examples

How to Rename a Table in MySQL In this tutorial, you will learn how to rename a table using the MySQL RENAME TABLE statement. See also: MySQL ALTER TABLE statement RENAME TABLE Syntax To rename a table in MySQL, use the following statement: RENAME TABLE old_table_name TO new_table_name; You can also rename multiple tables at … Read more

MySQL CURDATE() Function with Examples

How to Get the Current Date in MySQL using CURDATE() In this tutorial, you’ll learn how to use the MySQL CURDATE() function. CURDATE() is a function to return the current date. MySQL CURDATE() Syntax The syntax of the CURDATE() function is as follows: CURDATE() Remark This function is equal to the CURRENT_DATE() function MySQL returns … Read more

MySQL DROP USER – Delete Users in MySQL

How to remove user accounts in MySQL with Examples This tutorial explains how to use the DROP USER statement to delete user accounts and their privileges in MySQL. Learn more: How to create users in MySQL DROP USER Syntax The syntax of the DROP USER statement is as follows: DROP USER user [, user] … … Read more

Python return Statement with Examples

How to use the Python return Statement In this tutorial, you’ll learn how to use the Python return statement with examples. What is the return statement in Python? A return statement is a statement that occurs in a function definition used to return a value to a function call. The return Statement Syntax The following … Read more

Python List Methods and Functions with Examples

List Methods and Functions in Python Python has some list methods and built-in functions that you can use on lists. 1. List Methods The following is a list of Python list methods: Method Description append(item) Adds an element to the end of the list ——————————– Example:list = [‘Apple’, ‘Grape’, ‘Melon’]list.append(‘Mango’) extend(iterable) Adds all elements of … Read more