Generated by All in One SEO v5.0.0.1, this is an llms.txt file, used by LLMs to index the site. # MySQL Tutorial Learn MySQL ## Sitemaps - [XML Sitemap](https://www.mysqltutor.com/sitemap.xml): Contains all public & indexable URLs for this website. ## Posts - [MySQL SUBDATE function](https://www.mysqltutor.com/mysql-subdate-function/) - The SUBDATE function in MySQL is a built-in function used to subtract a specified time interval from a date. This function is useful for manipulating date values, particularly when you need to calculate dates in the past relative to a given date. It allows you to subtract days, weeks, months, and even years from a - [MySQL CREATE TRIGGER](https://www.mysqltutor.com/mysql-create-trigger/) - In MySQL, a trigger is a set of instructions that are automatically executed (or "triggered") in response to specific events on a particular table. These events can include INSERT, UPDATE, or DELETE operations. The CREATE TRIGGER statement is used to define a new trigger in MySQL. Syntax Here is the basic syntax for creating a - [MySQL String Functions](https://www.mysqltutor.com/mysql-string-functions/) - MySQL provides a wide range of string functions that are essential for manipulating and analyzing text data. These functions enable users to perform tasks like concatenating strings, extracting substrings, converting text to uppercase or lowercase, measuring string length, and trimming whitespace. Concatenation (CONCAT) The CONCAT function is used to join two or more strings together. - [MySQL JSON Functions](https://www.mysqltutor.com/mysql-json-functions/) - MySQL JSON Functions provide a set of tools for working with JSON data within MySQL databases. They allow you to create, manipulate, and extract data from JSON documents stored in columns. These functions enable you to efficiently manage and analyze JSON data within MySQL applications. Creating JSON Data The JSON_ARRAY and JSON_OBJECT functions serve as - [MySQL variables](https://www.mysqltutor.com/mysql-variables/) - MySQL variables are fundamental components of the MySQL database management system (DBMS) that serve as containers for storing temporary values during database operations. The MySQL variables are used to store and manage values temporarily during the execution of queries and scripts. These variables can be classified into two main types: user-defined variables and system variables. - [MySQL stored procedures](https://www.mysqltutor.com/mysql-stored-procedures/) - Stored procedures in MySQL are precompiled SQL statements that are stored in the database and can be executed later. They are used to encapsulate a set of SQL statements into a single unit, making it easier to manage and execute complex operations. MySQL stored procedures offer several advantages, including improved code reusability, enhanced security, and - [MySQL CREATE INDEX](https://www.mysqltutor.com/mysql-create-index/) - The CREATE INDEX statement is a fundamental SQL command used in MySQL databases to create indexes on tables. Indexes are data structures that help MySQL retrieve data from tables more efficiently. They are essentially pointers or lookup tables that store the location of specific rows in a table based on certain columns. By creating indexes - [MySQL DROP VIEW](https://www.mysqltutor.com/mysql-drop-view/) - The DROP VIEW statement in MySQL is used to remove an existing view from the database. A view in MySQL is a virtual table based on the result of a SELECT query. It allows users to simplify complex queries, encapsulate logic, and present data in a more meaningful way. Syntax Here is the basic syntax - [MySQL DROP EVENT](https://www.mysqltutor.com/mysql-drop-event/) - The MySQL DROP EVENT statement is used to remove a scheduled event from the database. In MySQL, an event is a task that is executed according to a specified schedule. Events can be used to automate repetitive database tasks, such as backups, data maintenance, or other periodic operations. Syntax Here is the basic syntax for - [MySQL ALTER EVENT](https://www.mysqltutor.com/mysql-alter-event/) - The ALTER EVENT statement in MySQL is used to modify the properties of an existing event. An event in MySQL is a scheduled task that can be executed at a specified time or interval. The ALTER EVENT statement allows you to change various attributes of an event without having to drop and recreate it. Syntax - [MySQL SHOW EVENTS](https://www.mysqltutor.com/mysql-show-events/) - The SHOW EVENTS statement in MySQL displays information about events managed by the Event Scheduler, a component that allows for scheduling recurring or one-time tasks to be executed automatically on the server. This statement is useful for examining the current status of events, identifying their scheduling information, and verifying their execution history. Syntax Here's a - [MySQL TRUNCATE](https://www.mysqltutor.com/mysql-truncate/) - The TRUNCATE function in MySQL is used to quickly delete all rows from a table and reset the auto-increment counter, if the table has an auto-increment column. It is a faster and more efficient alternative to the DELETE statement when you want to remove all records from a table. Unlike DELETE, which removes rows one - [MySQL datetime format](https://www.mysqltutor.com/mysql-datetime-format/) - MySQL is a powerful relational database management system (RDBMS) that is widely used for web database applications. One of the critical features of MySQL is its ability to handle date and time values, which are essential for almost every database application. Understanding the MySQL datetime format is crucial for developers and database administrators to ensure - [MySQL STR_TO_DATE function](https://www.mysqltutor.com/mysql-str_to_date-function/) - The STR_TO_DATE function in MySQL is a powerful tool for converting string data into a date or datetime format, enabling easier manipulation and querying of date-based data within a database. This function is particularly useful when you are dealing with data imported from external sources where dates might be represented as strings in various formats. - [MySQL convert string to date](https://www.mysqltutor.com/mysql-convert-string-to-date/) - MySQL, a prominent open-source relational database management system, is widely utilized for its flexibility, reliability, and robust performance in handling large datasets. One common task in database management and data analysis is converting strings to dates. This conversion is crucial for sorting, filtering, and performing date arithmetic on data stored as text. In this article, - [MySQL create temporary table](https://www.mysqltutor.com/mysql-create-temporary-table/) - Temporary tables are a feature of MySQL that provide a convenient way of storing and manipulating intermediate results within your database operations. They are designed to be a short-lived storage mechanism that allows developers and database administrators to work with temporary data without affecting the main database schema and data. Here's an extensive overview of - [MySQL CALL](https://www.mysqltutor.com/mysql-call/) - The CALL statement in MySQL is used to execute a stored procedure. A stored procedure is a set of SQL statements that can be stored in the database and executed later. It allows you to encapsulate a series of SQL statements into a single named routine, providing modularity and reusability. Syntax Here's the basic syntax - [MySQL CREATE FUNCTION](https://www.mysqltutor.com/mysql-create-function/) - The CREATE FUNCTION statement in MySQL is used to create a user-defined stored function. A stored function is a set of SQL statements that perform a specific task and can be reused in various parts of a SQL query or script. Functions are part of MySQL's support for procedural programming, allowing developers to encapsulate logic - [MySQL current datetime](https://www.mysqltutor.com/mysql-current-datetime/) - MySQL, a widely used open-source relational database management system, offers various functions to handle date and time values efficiently. One of the most important aspects of database management and application development is the ability to work with current date and time values. MySQL provides several functions for this purpose, including NOW(), CURDATE(), CURTIME(), and UNIX_TIMESTAMP(), - [MySQL CREATE PROCEDURE](https://www.mysqltutor.com/mysql-create-procedure/) - In MySQL, the CREATE PROCEDURE statement is used to define and create a stored procedure. Stored procedures are self-contained blocks of SQL code that are stored in the database and can be executed multiple times. They are often used to encapsulate complex SQL operations or to perform repetitive tasks. Syntax The basic syntax of the - [MySQL CREATE VIEW](https://www.mysqltutor.com/mysql-create-view/) - In MySQL, a CREATE VIEW statement is used to create a virtual table based on the result set of a SELECT query. A view is a named, saved query that can be treated like a table, allowing you to simplify complex queries, encapsulate logic, and provide a layer of abstraction over the underlying tables. Views - [MySQL CREATE EVENT](https://www.mysqltutor.com/mysql-create-event/) - The MySQL CREATE EVENT statement is used to create and schedule events that will be executed at specified intervals or specific points in time. Events in MySQL are similar to scheduled tasks or cron jobs in other systems. They allow you to automate recurring tasks such as database maintenance, data updates, or any other operations - [MySQL DROP TRIGGER](https://www.mysqltutor.com/mysql-drop-trigger/) - In MySQL, the DROP TRIGGER statement is used to remove a trigger from a database. Triggers are database objects that are associated with a specific table and are executed automatically when certain events occur on that table, such as INSERT, UPDATE, or DELETE operations. Syntax The syntax for the DROP TRIGGER statement is as follows: - [MySQL DROP INDEX](https://www.mysqltutor.com/mysql-drop-index/) - In MySQL, the DROP INDEX statement is used to remove one or more indexes from a table. Indexes in a database are structures that enhance the speed of data retrieval operations on database tables. They provide a quick way to look up data based on the values in specific columns. While indexes can significantly improve - [MySQL User-defined variables](https://www.mysqltutor.com/mysql-user-defined-variables/) - MySQL allows users to define and use variables within SQL statements. These user-defined variables provide a way to store and manipulate data temporarily during the execution of a series of SQL statements. User-defined variables in MySQL are prefixed with the '@' symbol. Here's a basic overview of MySQL user-defined variables: Variable Declaration To declare a - [MySQL System variables](https://www.mysqltutor.com/mysql-system-variables/) - MySQL system variables are configuration settings that control how the MySQL server operates. These variables can be set at server startup or at runtime using the SET statement. They can also be used in expressions to dynamically adjust server behavior. Types of MySQL System Variables MySQL system variables can be broadly categorized into three types: - [MySQL Functions](https://www.mysqltutor.com/mysql-functions/) - MySQL provides a comprehensive set of built-in functions that allow users to perform various operations on data stored in databases. These functions can be broadly categorized into several groups, including string functions, numeric functions, date and time functions, and aggregate functions. Benefits of Using MySQL Functions Reduced Code Redundancy: Built-in functions eliminate the need to - [MySQL Math functions](https://www.mysqltutor.com/mysql-math-functions/) - MySQL provides a variety of math functions that allow users to perform mathematical operations on numeric data stored in a database. These functions can be useful for performing calculations, aggregations, and transformations on numerical values within SQL queries. Here are some commonly used MySQL math functions: ABS: This function returns the absolute value of a - [MySQL RAND](https://www.mysqltutor.com/mysql-rand/) - The MySQL RAND() function is a built-in function that generates a random floating-point value between 0 (inclusive) and 1 (exclusive). It is often used to introduce randomness into queries, such as when you want to retrieve a random subset of rows from a table. Syntax Here's the basic syntax of the RAND() function: RAND() When - [MySQL Aggregate Functions](https://www.mysqltutor.com/mysql-aggregate-functions/) - MySQL aggregate functions are a set of functions that operate on a set of values and return a single, aggregated value. These functions are commonly used in SQL queries to perform calculations on groups of rows and are particularly useful when working with large datasets. What are Aggregate Functions? Aggregate functions operate on a set - [MySQL GROUP_CONCAT](https://www.mysqltutor.com/mysql-group_concat/) - The GROUP_CONCAT function in MySQL is a powerful function for aggregating and concatenating values from multiple rows into a single string. It is particularly useful when you want to combine values from a column based on a common attribute or grouping. The result is a comma-separated list of values, but you can customize the separator - [MySQL DATE Functions](https://www.mysqltutor.com/mysql-date-functions/) - MySQL provides a comprehensive set of date and time functions for manipulating and extracting information from date and time values. These functions are essential for various data manipulation tasks, including retrieving current dates and times, calculating date differences, formatting date and time values, and extracting specific components from date and time expressions. Here's a breakdown - [MySQL REGEXP Functions](https://www.mysqltutor.com/mysql-regexp-functions/) - MySQL provides several REGEXP (regular expression) functions that allow you to work with regular expressions in your SQL queries. Regular expressions are powerful patterns that are used for pattern matching within strings. Here are some of the key MySQL REGEXP functions: REGEXP The REGEXP function is used in the WHERE clause to perform a regular - [MySQL Window Functions](https://www.mysqltutor.com/mysql-window-functions/) - MySQL Window Functions are powerful tools that allow you to perform calculations across a set of table rows related to the current row. These functions are particularly useful when you need to analyze and derive insights from your data based on specific ordering or partitions within your result set. Here are some commonly used MySQL - [MySQL Information Functions](https://www.mysqltutor.com/mysql-information-functions/) - MySQL provides various information functions that allow you to retrieve details about the database server, user sessions, and other relevant information. Here's an overview of some of the key information functions: Function Description CONNECTION_ID() Returns the unique connection identifier for the current session. Useful for identifying different connections in a multi-user environment. CURRENT_ROLE() Returns the - [MySQL Encryption and Compression Functions](https://www.mysqltutor.com/mysql-encryption-compression-functions/) - MySQL provides encryption and compression functions that allow users to enhance the security and performance of their databases. Two commonly used encryption functions in MySQL are MD5 and SHA2. MD5 Overview: MD5 is a widely used cryptographic hash function that produces a 128-bit hash value (32 characters) from any input data. While MD5 is no - [MySQL XML Functions](https://www.mysqltutor.com/mysql-xml-functions/) - MySQL XML functions, including EXTRACTVALUE and UPDATEXML, provide powerful tools for working with XML data within a relational database environment. These functions are particularly useful when dealing with scenarios where XML information needs to be extracted, manipulated, or updated within a MySQL database. Common Usage Both EXTRACTVALUE and UPDATEXML are commonly used for various tasks - [MySQL Cast Functions](https://www.mysqltutor.com/mysql-cast-functions/) - MySQL provides the CAST and CONVERT functions to perform explicit type conversions, allowing you to convert data from one data type to another. Both functions essentially serve the same purpose, but there are some differences in their syntax and usage. CAST function The CAST() function is used to explicitly convert an expression or a value - [MySQL Comparison Functions](https://www.mysqltutor.com/mysql-comparison-functions/) - MySQL provides several comparison functions that are useful for handling null values and comparing multiple expressions. These functions include COALESCE, GREATEST, LEAST, IS NOT NULL, and IS NULL. Comparison functions in MySQL compare two or more values and return a Boolean value (TRUE or FALSE) or a specific value based on the comparison. These functions - [MySQL Flow Control Functions](https://www.mysqltutor.com/mysql-flow-control-functions/) - MySQL Flow Control Functions are essential tools for managing the flow of execution within SQL queries, allowing for conditional logic and handling NULL values efficiently. Among these functions, the CASE, IF, IFNULL, and NULLIF functions play key roles in controlling the flow of execution based on specific conditions. CASE Function: The CASE function in MySQL - [MySQL MOD](https://www.mysqltutor.com/mysql-mod/) - The MySQL MOD function is a mathematical function that returns the remainder of a division operation. It calculates the remainder when one number is divided by another. It is commonly used in various scenarios, including determining if a number is even or odd, calculating day of the week, partitioning datasets, and error handling. Syntax The - [MySQL TRUNCATE](https://www.mysqltutor.com/mysql-truncate-math-function/) - The TRUNCATE() function in MySQL is used to truncate a number to a specified number of decimal places. This function is similar to the ROUND() function, but it does not perform any rounding. Instead, it simply removes the specified number of digits from the decimal part of the number. Syntax The syntax of the TRUNCATE() - [MySQL VERSION](https://www.mysqltutor.com/mysql-version/) - The VERSION() function in MySQL is used to retrieve the version number of the MySQL server that you are currently connected to. This function can be useful in various scenarios, such as when you need to check the server version for compatibility or if you simply want to display the MySQL server version in your - [MySQL SYSTEM_USER](https://www.mysqltutor.com/mysql-system_user/) - In MySQL, the SYSTEM_USER() function is a built-in system function that returns the current MySQL user name and hostname. It doesn't require any arguments and is typically used to identify the current user accessing the MySQL database. The function is equivalent to the USER() function and SESSION_USER() function, which also return the current user information. - [MySQL SESSION_USER](https://www.mysqltutor.com/mysql-session_user/) - The SESSION_USER() function in MySQL is used to retrieve the current user and host name for the MySQL session. It returns a string in the format 'user_name'@'host_name', indicating the user and host associated with the current session. Syntax Here is the syntax for the SESSION_USER() function: SESSION_USER() Example Now, let's look at an example to - [MySQL USER](https://www.mysqltutor.com/mysql-user/) - In MySQL, the USER() function is used to retrieve the current user name and host name combination that is used to authenticate to the MySQL server. This function can be helpful in various scenarios, such as auditing or logging, where you need to track which user is executing certain SQL statements. Syntax Here is the - [MySQL SCHEMA](https://www.mysqltutor.com/mysql-schema/) - In MySQL, the SCHEMA() function is a built-in function that returns the current database name as a string. It is a synonym for the DATABASE() function and is used to determine the active database within a MySQL session. The function returns a UTF-8 encoded string representing the current database name. If no database has been - [MySQL ROW_COUNT](https://www.mysqltutor.com/mysql-row_count/) - The ROW_COUNT() function in MySQL is used to obtain the number of rows affected by the last statement that directly or indirectly modifies a table. This can be particularly useful in scenarios where you want to know the number of rows affected by an INSERT, UPDATE, or DELETE statement. Syntax Here is the basic syntax - [MySQL DATABASE](https://www.mysqltutor.com/mysql-database/) - The DATABASE() function in MySQL is a simple and straightforward function that returns the name of the current database. It does not require any parameters and can be used within SQL statements to dynamically reference the current database. Syntax The syntax for the DATABASE() function is as follows: DATABASE() Example Let's consider a simple example - [MySQL CURRENT_USER](https://www.mysqltutor.com/mysql-current_user/) - The CURRENT_USER() function in MySQL is used to return the current user name and host name combination for the MySQL session. It is often employed to retrieve information about the user who is currently connected to the MySQL server. The function provides details in the format 'user_name'@'host_name'. Syntax Here is the syntax for the CURRENT_USER() - [MySQL CURRENT_ROLE](https://www.mysqltutor.com/mysql-current_role/) - In MySQL, the CURRENT_ROLE function is a built-in function that returns the current active roles for the current session. A role is a named collection of privileges that can be granted to users or other roles. The current role determines the access privileges that are available to the user for the current session. Syntax The - [MySQL CONNECTION_ID](https://www.mysqltutor.com/mysql-connection_id/) - The CONNECTION_ID function in MySQL is used to retrieve the connection ID (thread ID) for the current client session. Each client session that connects to the MySQL server is assigned a unique connection ID, which can be useful for various administrative and diagnostic purposes. Syntax The syntax for the CONNECTION_ID function is quite simple: CONNECTION_ID() - [MySQL JSON_OBJECTAGG](https://www.mysqltutor.com/mysql-json_objectagg/) - In the realm of MySQL database management, the JSON_OBJECTAGG function plays a crucial role in manipulating and aggregating JSON data. It facilitates the creation of JSON objects from key-value pairs extracted from specific columns. This function's versatility extends to aggregating data based on group-by criteria, enabling the creation of comprehensive JSON representations of aggregated information. - [MySQL JSON_ARRAYAGG](https://www.mysqltutor.com/mysql-json_arrayagg/) - The JSON_ARRAYAGG function in MySQL is used to aggregate values into a JSON array. It is particularly useful when you want to combine multiple rows of data into a single JSON array. This function was introduced in MySQL version 5.7.22. Syntax The basic syntax for the JSON_ARRAYAGG function is as follows: JSON_ARRAYAGG(expr) expr: The expression - [MySQL MEMBER OF](https://www.mysqltutor.com/mysql-member-of/) - The MEMBER OF function in MySQL is used to determine whether a specified value is an element of a JSON array. It takes two parameters: value and json_array. The value parameter can be any valid JSON value, and the json_array parameter must be a valid JSON array. Syntax Here is the syntax for the MEMBER - [MySQL JSON_VALUE](https://www.mysqltutor.com/mysql-json_value/) - The JSON_VALUE function in MySQL is used to extract a scalar value from a JSON document. It allows you to retrieve a specific value from a JSON string based on a specified JSON path expression. This function is part of MySQL's support for JSON, which enables you to work with JSON data within the relational - [MySQL JSON_VALID](https://www.mysqltutor.com/mysql-json_valid/) - The JSON_VALID function in MySQL is used to check whether a given string is a valid JSON document or not. This function is particularly useful when you need to ensure that the data stored in a column with the JSON data type is well-formed JSON. Syntax Here is the syntax for the JSON_VALID function: JSON_VALID(json_document) - [MySQL JSON_UNQUOTE](https://www.mysqltutor.com/mysql-json_unquote/) - MySQL's JSON_UNQUOTE function is used to remove quotation marks from a JSON string and return the unquoted result. This can be useful when you want to extract a specific value from a JSON string or manipulate the data within a JSON object. Syntax The basic syntax for the JSON_UNQUOTE function is as follows: JSON_UNQUOTE(json_string) json_string: - [MySQL JSON_TYPE](https://www.mysqltutor.com/mysql-json_type/) - The JSON_TYPE function in MySQL is used to determine the type of a given JSON value. It takes a JSON value as an argument and returns a string that represents the type of the value. Valid JSON values include objects, arrays, scalar types (e.g., integers, strings, booleans), and null values. Syntax JSON_TYPE(json_val) Where: json_val is - [MySQL JSON_TABLE](https://www.mysqltutor.com/mysql-json_table/) - The JSON_TABLE function in MySQL is a powerful feature introduced in MySQL 8.0 for handling JSON data. It allows you to transform JSON data into relational format, enabling you to query and extract specific information from JSON documents. Syntax The basic syntax of the JSON_TABLE function is as follows: JSON_TABLE( json_data, path_expression COLUMNS ( column_name1 - [MySQL JSON_STORAGE_SIZE](https://www.mysqltutor.com/mysql-json_storage_size/) - In MySQL, the JSON_STORAGE_SIZE is a valuable function for managing and optimizing the storage of JSON data. It provides information about the amount of storage space occupied by a JSON document, both in string representation and in binary form. This information can be used to track storage usage, estimate data growth, and optimize database performance. - [MySQL JSON_STORAGE_FREE](https://www.mysqltutor.com/mysql-json_storage_free/) - The MySQL JSON_STORAGE_FREE function returns the amount of storage space freed after a JSON column has been updated by JSON_SET, JSON_REPLACE, or JSON_REMOVE. This function is useful for optimizing storage usage when performing partial updates on JSON columns. Syntax JSON_STORAGE_FREE(json_val) Where: json_val is the JSON value or JSON string that represents the updated JSON column. - [MySQL JSON_REMOVE](https://www.mysqltutor.com/mysql-json_remove/) - The JSON_REMOVE function in MySQL is used to remove a specified element from a JSON document. It is part of the JSON functions introduced in MySQL version 5.7.8 and later. The function takes two arguments: the JSON document and the path to the element that needs to be removed. The result is a new JSON - [MySQL JSON_SET](https://www.mysqltutor.com/mysql-json_set/) - The JSON_SET function in MySQL is used to insert or update values in a JSON document. It allows you to modify a JSON document by adding new key-value pairs or updating existing ones. The function effectively combines the functionality of JSON_INSERT and JSON_REPLACE, simplifying the process of modifying JSON data within a single statement. Syntax - [MySQL JSON_SEARCH](https://www.mysqltutor.com/mysql-json_search/) - The JSON_SEARCH function in MySQL is used to search for a specified value within a JSON document. It returns the path to the first occurrence of the specified value within the JSON document. This function is particularly useful when working with JSON data stored in MySQL databases. Syntax Here is the basic syntax of the - [MySQL JSON_SCHEMA_VALIDATION_REPORT](https://www.mysqltutor.com/mysql-json_schema_validation_report/) - In MySQL, the JSON_SCHEMA_VALIDATION_REPORT function serves an essential role in validating JSON documents against JSON schemas. It provides a comprehensive report on validation failures, enabling developers to identify and rectify errors effectively. This functionality is particularly valuable for maintaining data integrity and ensuring adherence to specific data structures. Syntax The syntax of the JSON_SCHEMA_VALIDATION_REPORT function - [MySQL JSON_SCHEMA_VALID](https://www.mysqltutor.com/mysql-json_schema_valid/) - The JSON_SCHEMA_VALID function in MySQL is used to validate a JSON document against a JSON schema. It is a valuable tool for ensuring the integrity and consistency of JSON data stored in MySQL databases. The primary purpose of the JSON_SCHEMA_VALID function is to enforce data validation rules within MySQL. By comparing a JSON document to - [MySQL JSON_REPLACE](https://www.mysqltutor.com/mysql-json_replace/) - The JSON_REPLACE function in MySQL is used to replace a specific value in a JSON document with a new value. It allows you to update the content of a JSON object by specifying the path to the element you want to replace and providing the new value. Syntax Here is the syntax for the JSON_REPLACE - [MySQL JSON_QUOTE](https://www.mysqltutor.com/mysql-json_quote/) - The MySQL JSON_QUOTE function is used to surround a JSON string with double quotation marks and escape any special characters within the string. This is particularly useful when you need to create valid JSON strings within SQL queries or when working with JSON data in MySQL. The primary purpose of JSON_QUOTE is to prepare strings - [MySQL JSON_PRETTY](https://www.mysqltutor.com/mysql-json_pretty/) - In MySQL, the JSON_PRETTY function is used to format JSON values in a human-readable manner, making them easier to interpret and debug. It applies indentation and newline characters to the JSON structure, enhancing its readability compared to the compact, machine-readable format. Syntax JSON_PRETTY(json_val) Arguments: json_val: A JSON value or a string representation of a JSON - [MySQL JSON_OVERLAPS](https://www.mysqltutor.com/mysql-json_overlaps/) - The MySQL JSON_OVERLAPS function is used to determine if two JSON documents share any common key-value pairs, array elements, or scalar values. It returns a value of 1 (true) if the documents have any overlap and 0 (false) if they do not. The JSON_OVERLAPS function was introduced in MySQL 8.0.17 and complements the JSON_CONTAINS function, - [MySQL JSON_OBJECT](https://www.mysqltutor.com/mysql-json_object/) - The JSON_OBJECT function in MySQL is used to create a JSON object from a set of key-value pairs. This function is particularly useful when you want to generate JSON data within a SQL query, especially when working with JSON-related features introduced in MySQL 5.7 and later versions. Syntax Here is the syntax for the JSON_OBJECT - [MySQL JSON_MERGE](https://www.mysqltutor.com/mysql-json_merge/) - The MySQL JSON_MERGE function is used to combine two or more JSON documents into a single document. It is a versatile tool for working with JSON data in MySQL, enabling you to merge nested structures, arrays, and scalar values. The function was introduced in MySQL 5.7.22 and has been deprecated since MySQL 8.0.3. However, it - [MySQL JSON_MERGE_PRESERVE](https://www.mysqltutor.com/mysql-json_merge_preserve/) - The JSON_MERGE_PRESERVE function in MySQL is used to merge two or more JSON documents while preserving duplicate keys. This means that if there are overlapping keys in the input JSON documents, the function will merge them into a single JSON document, keeping all the values associated with each unique key. If a key appears in - [MySQL JSON_MERGE_PATCH](https://www.mysqltutor.com/mysql-json_merge_patch/) - The JSON_MERGE_PATCH function in MySQL is used to merge two JSON objects, where the values from the second JSON object overwrite the corresponding values in the first one. If a key exists in both JSON objects, the value from the second object is used. If a key exists in the first object but not in - [MySQL JSON_LENGTH](https://www.mysqltutor.com/mysql-json_length/) - The JSON_LENGTH function in MySQL is used to find the number of elements in a JSON array or the number of keys in a JSON object. This function helps you retrieve the length of a JSON array or the number of keys in a JSON object within a MySQL database. The JSON_LENGTH function can be - [MySQL JSON_EXTRACT](https://www.mysqltutor.com/mysql-json_extract/) - The JSON_EXTRACT function in MySQL is used to extract data from a JSON document. It allows you to retrieve a specific value or object from a JSON string based on a given JSON path expression. This function is particularly useful when dealing with JSON data stored in a MySQL database. Syntax JSON_EXTRACT(json_document, path) json_document: The - [MySQL JSON_KEYS](https://www.mysqltutor.com/mysql-json_keys/) - The JSON_KEYS function in MySQL is used to extract the keys from a JSON object. It returns a JSON array containing the keys of the input JSON object. This function can be particularly useful when you want to retrieve the keys of a JSON document and use them for further processing or analysis. Syntax Here - [MySQL JSON_INSERT](https://www.mysqltutor.com/mysql-json_insert/) - The JSON_INSERT function in MySQL is used to insert a new value into a specified JSON document at a specified path. This function is particularly useful when working with JSON data types in MySQL, allowing you to modify and update JSON documents. Syntax Here is the syntax for the JSON_INSERT function: JSON_INSERT(json_doc, path, val[, path, - [MySQL JSON_DEPTH](https://www.mysqltutor.com/mysql-json_depth/) - The JSON_DEPTH function in MySQL is used to determine the depth of a given JSON document or JSON array. The depth of a JSON document refers to the level of nesting within the structure. In other words, it indicates how deeply elements are nested within the JSON hierarchy. Syntax Here is the syntax for the - [MySQL JSON_CONTAINS](https://www.mysqltutor.com/mysql-json_contains/) - The MySQL JSON_CONTAINS function is used to check whether a specified JSON value or path exists within a JSON document or array. The JSON_CONTAINS function is useful for querying JSON data stored in MySQL databases. Syntax The general syntax for the JSON_CONTAINS function is as follows: JSON_CONTAINS(json_doc, val[, path]) json_doc: The JSON document or array - [MySQL JSON_CONTAINS_PATH](https://www.mysqltutor.com/mysql-json_contains_path/) - The JSON_CONTAINS_PATH function in MySQL is used to check if a JSON document contains a specified path expression. This function returns 1 if the path expression is found in the JSON document; otherwise, it returns 0. Syntax Here is the syntax for the JSON_CONTAINS_PATH function: JSON_CONTAINS_PATH(json_doc, path[, one_or_all]) json_doc: The JSON document to be searched. - [MySQL JSON_ARRAY_INSERT](https://www.mysqltutor.com/mysql-json_array_insert/) - The JSON_ARRAY_INSERT function in MySQL is used to insert one or more values into a specified position within a JSON array. This function is particularly useful when working with JSON data in MySQL, allowing you to modify and update JSON arrays easily, enabling the insertion of new data points without altering the entire document. Syntax - [MySQL JSON_ARRAY_APPEND](https://www.mysqltutor.com/mysql-json_array_append/) - The JSON_ARRAY_APPEND function in MySQL is used to append values to a specified JSON array within a JSON document. This function is part of the JSON functions introduced in MySQL 5.7 for working with JSON data types. Syntax Here is the syntax for the JSON_ARRAY_APPEND function: JSON_ARRAY_APPEND(json_doc, path, val[, path, val]...) json_doc: The JSON document - [MySQL JSON_ARRAY](https://www.mysqltutor.com/mysql-json_array/) - The JSON_ARRAY function in MySQL is used to create a JSON array from a list of values. This function can be helpful when you want to generate a JSON array in MySQL for use in JSON-related operations or when storing JSON data in a table. Using JSON_ARRAY directly within MySQL queries provides several advantages: Performance: - [MySQL ROW_NUMBER](https://www.mysqltutor.com/mysql-row_number/) - The ROW_NUMBER function in MySQL is a window function that assigns a unique sequential integer to each row within a partition of a result set. It is commonly used in scenarios where you need to generate a unique identifier for each row based on a specific order. The function is part of the window functions - [MySQL PERCENT_RANK](https://www.mysqltutor.com/mysql-percent_rank/) - The MySQL PERCENT_RANK function is used to calculate the relative rank of a row within a result set as a percentage. It is particularly useful in scenarios where you want to know the position of a specific row in relation to the entire result set. The PERCENT_RANK function returns a value between 0 and 1, - [MySQL NTILE](https://www.mysqltutor.com/mysql-ntile/) - The MySQL NTILE function is used to divide the result set into a specified number of roughly equal groups, or tiles. This can be particularly useful when you want to distribute data into a specific number of buckets or segments based on a specified order. The NTILE function offers several benefits for data analysts and - [MySQL NTH_VALUE](https://www.mysqltutor.com/mysql-nth_value/) - The MySQL NTH_VALUE function is a window function that returns the value of a given expression from the Nth row of the window frame. It is useful for retrieving values from a specific position within an ordered set of rows. Syntax The syntax of the NTH_VALUE function is as follows: NTH_VALUE(expr, N) OVER ([PARTITION BY - [MySQL LEAD](https://www.mysqltutor.com/mysql-lead/) - The MySQL LEAD function is a window function that allows you to access the value of a subsequent row within the result set. This can be particularly useful for tasks such as comparing the current row's value with the next row's value or performing calculations based on the next row's data. The LEAD function can - [MySQL LAG](https://www.mysqltutor.com/mysql-lag/) - The LAG function in MySQL is a window function that allows you to access data from a previous row within the result set of a query. This can be particularly useful for performing calculations that involve comparing the current row with the preceding one. The LAG function helps in obtaining values from a specific column - [MySQL LAST_VALUE](https://www.mysqltutor.com/mysql-last_value/) - The MySQL LAST_VALUE window function is used to retrieve the value of an expression from the last row within a specified window frame. The window frame is a group of rows that are considered together for calculations. The LAST_VALUE function is particularly useful for analyzing trends and identifying patterns in data. Syntax The general syntax - [MySQL FIRST_VALUE](https://www.mysqltutor.com/mysql-first_value/) - The MySQL FIRST_VALUE function is a window function that allows you to retrieve the first value in an ordered set of rows within a partition. This function is often used in conjunction with the OVER clause to define the window frame for the operation. Syntax Here is the basic syntax of the FIRST_VALUE function: FIRST_VALUE(expression) - [MySQL RANK](https://www.mysqltutor.com/mysql-rank/) - The MySQL RANK function is used to assign a rank to each row within the result set of a query based on the values of one or more columns. It is commonly used in scenarios where you want to determine the rank of each row relative to others, such as in competitions, rankings, or leaderboards. - [MySQL DENSE_RANK](https://www.mysqltutor.com/mysql-dense_rank/) - The MySQL DENSE_RANK function is used to assign a unique rank to each distinct row within a result set based on the specified column or columns. Unlike the RANK function, DENSE_RANK does not leave gaps in the ranking when there are ties. If two or more rows have the same values for the ordering columns, - [MySQL CUME_DIST](https://www.mysqltutor.com/mysql-cume_dist/) - The MySQL CUME_DIST function is used to calculate the cumulative distribution of a set of values within a group of rows. It represents the relative position of a specified value within the group, considering the sorted order of the values. The result is a value between 0 and 1, indicating the cumulative distribution of the - [MySQL IS NOT NULL](https://www.mysqltutor.com/mysql-is-not-null/) - In MySQL, the IS NOT NULL comparison function is used to filter and retrieve records from a database where a specific column does not contain NULL values. NULL is a special marker used in databases to represent the absence of data in a particular field. The IS NOT NULL condition is often used in conjunction - [MySQL LEAST](https://www.mysqltutor.com/mysql-least/) - The MySQL LEAST function is part of comparison functions and is used to find the smallest or minimum value among a list of expressions. It is particularly useful when you have multiple values and you want to retrieve the smallest one. The LEAST function takes two or more arguments, and it returns the smallest value - [MySQL GREATEST](https://www.mysqltutor.com/mysql-greatest/) - The MySQL GREATEST function is used to retrieve the highest value from a list of expressions. It takes multiple arguments and returns the maximum value among them. It plays a crucial role in data analysis and manipulation, enabling you to identify the highest numerical value within a collection of data points. Whether you're dealing with - [MySQL IFNULL function](https://www.mysqltutor.com/mysql-ifnull-function/) - The IFNULL function in MySQL is used to handle NULL values in a query by replacing them with a specified alternative value. This function is particularly useful when you want to display a default value or perform some other action if a column contains NULL. Syntax The basic syntax of the IFNULL function is as - [MySQL COALESCE](https://www.mysqltutor.com/mysql-coalesce/) - The MySQL COALESCE function is a useful comparison function for handling NULL values in queries. It allows you to replace NULL values with a specified alternative value. The primary purpose of COALESCE is to return the first non-NULL expression among its arguments. Syntax Here's the syntax for the COALESCE function: COALESCE(expr1, expr2, ...) expr1, expr2, - [MySQL NULLIF function](https://www.mysqltutor.com/mysql-nullif-function/) - The NULLIF function in MySQL is used to compare two expressions. It returns NULL if the two expressions are equal; otherwise, it returns the first expression. The primary use case for NULLIF is to handle cases where you want to avoid division by zero or to handle situations where you want to treat specific values - [MySQL IF function](https://www.mysqltutor.com/mysql-if-function/) - The MySQL IF function is a control flow function that allows you to perform conditional logic within a query. It is commonly used in SELECT statements to return different values based on a specified condition. Syntax The syntax for the MySQL IF function is as follows: IF(condition, value_if_true, value_if_false) condition: The expression that evaluates to - [MySQL CASE function](https://www.mysqltutor.com/mysql-case-function/) - The MySQL CASE function is a powerful function used for conditional logic within SQL queries. It allows you to perform conditional operations based on specified conditions and return different values depending on whether the conditions are met or not. The CASE function is often used in conjunction with the SELECT statement to create more flexible - [MySQL MD5](https://www.mysqltutor.com/mysql-md5/) - The MySQL MD5 function is a cryptographic hash function that produces a 128-bit hash value, typically expressed as a 32-character hexadecimal number. MD5 (Message Digest Algorithm 5) is commonly used for generating hash values from data, such as passwords or other sensitive information, for storage and comparison purposes. Use Cases: Password Hashing: The MD5 hash - [MySQL SHA2](https://www.mysqltutor.com/mysql-sha2/) - The MySQL SHA2 function is used to generate a SHA-256 or SHA-512 hash value for a given string. This can be useful for storing sensitive information like passwords securely in a database, as the hash function converts the original data into a fixed-size string of characters that is typically considered irreversible. The SHA2 function is - [MySQL UPDATEXML](https://www.mysqltutor.com/mysql-updatexml/) - The MySQL UPDATEXML function is a powerful tool for modifying XML data within MySQL databases. It allows you to selectively replace portions of XML markup based on XPath expressions. This makes it a versatile and efficient way to update XML data stored in MySQL tables. Syntax Here is the basic syntax for the UPDATEXML function: - [MySQL EXTRACTVALUE](https://www.mysqltutor.com/mysql-extractvalue/) - The EXTRACTVALUE function in MySQL is a useful function for extracting specific data from XML documents stored in the database. It utilizes XPath expressions to locate the desired data within the XML markup and returns the extracted text. This function plays a crucial role in integrating XML data into MySQL applications and retrieving meaningful information - [MySQL CONVERT](https://www.mysqltutor.com/mysql-convert/) - The MySQL CONVERT function is used to convert a value from one data type to another. It is particularly useful when you need to manipulate or present data in a different format or type. The primary use of the CONVERT function is to convert data types within MySQL statements. It allows you to change the - [MySQL CAST](https://www.mysqltutor.com/mysql-cast/) - The MySQL CAST function is used to explicitly convert an expression or a value from one data type to another. This function is particularly useful when you need to convert data types explicitly, ensuring that the result is of the desired type. Syntax The basic syntax of the CAST function is as follows: CAST(expression AS - [MySQL RPAD](https://www.mysqltutor.com/mysql-rpad/) - The RPAD function in MySQL is used to pad a string with a specified number of characters on the right side. This function is particularly useful when you need to ensure that a string has a certain length by appending a specific character or a set of characters to the right. Syntax Here is the - [MySQL LPAD](https://www.mysqltutor.com/mysql-lpad/) - The LPAD function in MySQL is used to pad the left side of a string with a specified set of characters until the string reaches a desired length. This can be useful, for example, when you need to format data in a specific way, such as aligning numbers or creating fixed-width columns. Syntax Here is - [MySQL SUBSTR](https://www.mysqltutor.com/mysql-substr/) - The SUBSTR function in MySQL is used to extract a substring from a given string. It allows you to retrieve a specific portion of a string based on a specified starting position and, optionally, a specified length. Syntax Here is the syntax for the SUBSTR function in MySQL: SUBSTR(str, start[, length]) str: This is the - [MySQL REGEXP_SUBSTR](https://www.mysqltutor.com/mysql-regexp_substr/) - The REGEXP_SUBSTR function in MySQL is used to extract a substring of a string based on a regular expression pattern. It's similar to the SUBSTRING function, but instead of extracting a specified substring, it identifies and extracts the portion of the string that matches the given regular expression. Usages of REGEXP_SUBSTR Parsing Text: Extracting specific - [MySQL REGEXP_REPLACE](https://www.mysqltutor.com/mysql-regexp_replace/) - The MySQL REGEXP_REPLACE function is a powerful tool for pattern matching and string manipulation within MySQL databases. It allows you to search a string for a regular expression pattern and replace every occurrence of that pattern with a specified replacement string. This function is particularly useful for tasks such as cleaning up data, formatting text, - [MySQL REGEXP_LIKE](https://www.mysqltutor.com/mysql-regexp_like/) - The REGEXP_LIKE function in MySQL is used to perform regular expression matching in a query. It allows you to search for a specified pattern within a string column and retrieve rows that match the pattern. This function returns a boolean value, indicating whether the pattern is present in the specified column. Syntax Here is the - [MySQL REGEXP_INSTR](https://www.mysqltutor.com/mysql-regexp_instr/) - The REGEXP_INSTR function in MySQL is used to search for a regular expression pattern in a string and return the position of the first occurrence of the pattern. It is particularly useful when you want to find the starting position of a substring that matches a specified regular expression within a larger string. Syntax Here - [MySQL REGEXP](https://www.mysqltutor.com/mysql-regexp/) - The MySQL REGEXP function is used for pattern matching in strings using regular expressions. Regular expressions are powerful functions for searching, matching, and manipulating text based on patterns. The REGEXP function in MySQL allows you to perform pattern matching using regular expressions in your queries. Syntax The basic syntax of the REGEXP function in MySQL - [MySQL MATCH](https://www.mysqltutor.com/mysql-match/) - The MySQL MATCH function is used in the context of full-text search to perform searches against a table that has a FULLTEXT index. This function is particularly useful when you want to search for specific words or phrases within a text column efficiently. The MATCH function is commonly used in conjunction with the AGAINST keyword - [MySQL LTRIM](https://www.mysqltutor.com/mysql-ltrim/) - The LTRIM function in MySQL is used to remove leading spaces (or a specified character) from a string. It effectively eliminates whitespace characters that appear at the beginning of a string, ensuring that the resulting string starts with meaningful characters. This function finds extensive applications in data cleaning and data manipulation tasks, particularly when dealing - [MySQL TRIM](https://www.mysqltutor.com/mysql-trim/) - The MySQL TRIM function is a string manipulation function that allows you to remove specified prefixes or suffixes from a given string. Its primary purpose is to trim (remove) characters from the beginning, end, or both ends of a string. This can be useful for cleaning up data, especially when dealing with user input or - [MySQL RTRIM](https://www.mysqltutor.com/mysql-rtrim/) - The MySQL RTRIM function is used to remove trailing spaces from a given string. Trailing spaces refer to the spaces that appear at the end of a string. This function is particularly useful when dealing with data where spaces at the end may affect comparisons or display. The RTRIM function operates by scanning a string - [MySQL LEFT](https://www.mysqltutor.com/mysql-left/) - The MySQL LEFT function is part of string functions and is used to extract a specified number of characters from the left side of a string. It is a powerful function for manipulating and filtering data, and it is commonly used in various scenarios, including: Substring Extraction: The LEFT() function is ideal for extracting parts - [MySQL RIGHT](https://www.mysqltutor.com/mysql-right/) - The MySQL RIGHT is a string function, which extracts a specified number of characters from the right side of a string. Its syntax is as follows: Syntax RIGHT(str, length) str: This is the input string from which you want to extract characters. length: This parameter specifies the number of characters to extract from the right - [MySQL FORMAT](https://www.mysqltutor.com/mysql-format/) - The MySQL FORMAT function is used for numeric formatting and is different from formatting date and time values. The FORMAT function is used to format a numeric value with a specific number of decimal places and commas as thousands separators. Syntax Here's the basic syntax: FORMAT(number, [decimal_places]) number: The numeric value that you want to - [MySQL INSTR](https://www.mysqltutor.com/mysql-instr/) - The MySQL INSTR function is used to find the position of the first occurrence of a substring within a string. It returns the position of the substring if found, and 0 if the substring is not present in the given string. The INSTR function is case-sensitive, meaning it distinguishes between uppercase and lowercase characters. Syntax - [MySQL CONCAT_WS](https://www.mysqltutor.com/mysql-concat_ws/) - The MySQL CONCAT_WS function is a string function that stands for Concatenate With Separator. It is used to concatenate multiple strings into a single string, with a specified separator between each pair of strings. The primary purpose of CONCAT_WS is to simplify the process of concatenating strings while automatically adding a separator between them. Syntax - [MySQL CHAR_LENGTH](https://www.mysqltutor.com/mysql-char_length/) - The MySQL CHAR_LENGTH function is used to determine the number of characters in a given string. It is a character set-aware function, which means it takes into account the character set used for the string. The function returns the length of the string in characters, not bytes. Syntax Here's the basic syntax of the CHAR_LENGTH - [MySQL YEAR](https://www.mysqltutor.com/mysql-year-function/) - The MySQL YEAR function is a date and time function used to extract the year from a given date. It is particularly useful when you want to retrieve only the year portion of a date value stored in a MySQL database. Syntax The syntax for the YEAR function is quite straightforward: YEAR(date) Here, the date - [MySQL WEEKDAY](https://www.mysqltutor.com/mysql-weekday/) - The MySQL WEEKDAY function is used to determine the day of the week for a given date. It returns an integer value representing the day of the week, where Monday is assigned the value 0 and Sunday is assigned the value 6. This function can be particularly useful in scenarios where you need to perform - [MySQL WEEK](https://www.mysqltutor.com/mysql-week/) - The WEEK function in MySQL is a date and time function that is used to extract the week number from a given date. It is particularly useful when working with temporal data and analyzing trends over weeks. The WEEK function returns the week number according to either a Sunday or Monday-based week convention, depending on - [MySQL TIMESTAMP](https://www.mysqltutor.com/mysql-timestamp-function/) - The MySQL TIMESTAMP function is a date and time function that is commonly used for working with date and time values in MySQL databases. It is often employed to store and retrieve timestamps, which represent a specific point in time, with both date and time components. Here is a brief overview of the MySQL TIMESTAMP - [MySQL SYSDATE](https://www.mysqltutor.com/mysql-sysdate/) - In MySQL, the SYSDATE function is used to retrieve the current date and time from the system. This function returns a DATETIME value representing the current date and time in the system's time zone. It is important to note that the time zone used by SYSDATE is the time zone set on the MySQL server. - [MySQL TIME](https://www.mysqltutor.com/mysql-time-function/) - The MySQL TIME function is a built-in function that is used to extract the time portion from a datetime or timestamp expression. It is particularly useful when you have a datetime value and you want to isolate and work with only the time component. Syntax The basic syntax of the TIME function is as follows: - [MySQL SECOND](https://www.mysqltutor.com/mysql-second/) - The MySQL SECOND function is a date and time function that is used to extract the seconds component from a given time expression. It is particularly useful when you need to retrieve or manipulate specific parts of a time value. The basic syntax of the SECOND function is as follows: Syntax SECOND(time_expression) Here, time_expression is - [MySQL MONTH](https://www.mysqltutor.com/mysql-month/) - In MySQL, the MONTH function is used to extract the month from a date. It is particularly useful when you have a date column in your database, and you want to retrieve only the month part of it. Syntax The syntax for the MONTH function is quite straightforward: MONTH(date) Here, date is the input date - [MySQL MINUTE](https://www.mysqltutor.com/mysql-minute/) - The MINUTE function in MySQL extracts the minute component from a given time or datetime value. It returns an integer value ranging from 0 to 59, corresponding to the minutes in the specified time. This function is commonly used in conjunction with other date and time functions to perform various data analysis and manipulation tasks. - [MySQL LAST_DAY](https://www.mysqltutor.com/mysql-last_day/) - The MySQL LAST_DAY function is a date function that returns the last day of the month for a given date or date expression. It is particularly useful when you want to find the end date of a specific month. Syntax The syntax for the LAST_DAY function is as follows: LAST_DAY(date) Here, "date" is the input - [MySQL HOUR](https://www.mysqltutor.com/mysql-hour/) - The HOUR function in MySQL is used to extract the hour from a given time or datetime expression. It returns an integer value representing the hour of the specified time. Syntax Here's the basic syntax of the HOUR function: HOUR(time) time: This is the time or datetime value from which you want to extract the - [MySQL DAYNAME](https://www.mysqltutor.com/mysql-dayname/) - The MySQL DAYNAME function is a date and time function that is used to retrieve the name of the day of the week for a given date. It is particularly useful when you have a date value and you want to know the corresponding day of the week without having to manually interpret the date. - [MySQL EXTRACT](https://www.mysqltutor.com/mysql-extract/) - The MySQL EXTRACT function is a powerful tool that allows users to extract specific parts of a date or time value. It is particularly useful when you want to retrieve information such as the year, month, day, hour, minute, or second from a given date or time expression. Syntax The syntax for the EXTRACT function - [MySQL DAY](https://www.mysqltutor.com/mysql-day/) - The MySQL DAY function is a date and time function that extracts the day of the month from a given date. It is commonly used to retrieve the day part from a date expression in order to perform various operations or to display specific information based on the day. Syntax Here is the basic syntax - [MySQL DATE](https://www.mysqltutor.com/mysql-date/) - The MySQL DATE data type is used to store dates in the format 'YYYY-MM-DD.' It represents a calendar date without any time component. MySQL provides several date-related data types, including DATE, TIME, DATETIME, and TIMESTAMP, each serving different purposes. In this explanation, we'll focus specifically on the DATE data type. Syntax Here are some key - [MySQL DATE_SUB](https://www.mysqltutor.com/mysql-date_sub/) - The MySQL DATE_SUB function is a powerful date and time manipulation function that allows you to subtract a specified time interval from a given date or datetime expression. This function is particularly useful when you need to perform calculations involving date and time values in your MySQL queries. Syntax Here is the basic syntax of - [MySQL DATE_ADD](https://www.mysqltutor.com/mysql-date_add/) - The DATE_ADD function in MySQL is a powerful tool for manipulating date and time values within your queries. It allows you to add a specified time interval to a given date or datetime expression, resulting in a new date or datetime value. This function is particularly useful when you need to perform calculations or adjustments - [MySQL DATE](https://www.mysqltutor.com/mysql-date-function/) - The MySQL DATE function is a powerful tool for handling date-related operations within the MySQL database management system. It is used to extract the date part from a date or datetime expression. The DATE function is particularly useful when you want to work with dates without considering the time portion. Syntax The syntax for the - [MySQL CURTIME](https://www.mysqltutor.com/mysql-curtime/) - The CURTIME function in MySQL is used to retrieve the current time in the format 'HH:MM:SS' (hours, minutes, seconds). This function does not require any arguments and is invoked without parentheses. When called, it returns the current server time. Example Here is a basic example of how to use the CURTIME function: SELECT CURTIME(); The - [MySQL TIMESTAMP](https://www.mysqltutor.com/mysql-timestamp/) - The MySQL TIMESTAMP data type is used to store date and time values, representing a specific point in time. It is commonly used to track changes to records in database tables, such as when a row was created or last updated. The TIMESTAMP data type in MySQL has several characteristics and options that make it - [MySQL CURRENT_TIMESTAMP](https://www.mysqltutor.com/mysql-current_timestamp/) - The CURRENT_TIMESTAMP function in MySQL is a date and time function that returns the current date and time in the format 'YYYY-MM-DD HH:MM:SS'. It is commonly used to insert the current timestamp into a column when a new record is added to a table or to retrieve the current timestamp in queries. Key points Here - [MySQL CURDATE](https://www.mysqltutor.com/mysql-curdate/) - The MySQL CURDATE function is a date and time function that returns the current date without a time component. It is commonly used when you need to work with date values and want to obtain the current date for various purposes in a MySQL query or script. Syntax The syntax for the CURDATE function is - [MySQL CURRENT_TIME](https://www.mysqltutor.com/mysql-current_time/) - The CURRENT_TIME function in MySQL is used to retrieve the current time in the format 'HH:MM:SS' (hours, minutes, and seconds). This function does not require any arguments and is quite straightforward to use. When called, it returns the current time at the moment the function is executed based on the server's system clock. Example Here's - [MySQL CURRENT_DATE](https://www.mysqltutor.com/mysql-current_date/) - The MySQL CURRENT_DATE function is a date and time function that returns the current date in the format 'YYYY-MM-DD'. This function does not require any arguments and is often used when you need to retrieve the current date within a MySQL query or as a default value for a column. Syntax Here's a brief explanation - [MySQL NOW](https://www.mysqltutor.com/mysql-now/) - The MySQL NOW() function is a date and time function used to retrieve the current date and time from the system. It is often utilized in SQL queries to insert or update records with the current timestamp or to retrieve data based on the current date and time. Here's a brief overview of the MySQL - [MySQL CONVERT_TZ](https://www.mysqltutor.com/mysql-convert_tz/) - The MySQL CONVERT_TZ function is used to convert a datetime value from one time zone to another. This function is particularly useful when dealing with datetime data that needs to be presented or manipulated in a different time zone than the one in which it is stored. Syntax Here is the basic syntax of the - [MySQL ADDTIME](https://www.mysqltutor.com/mysql-addtime/) - The MySQL ADDTIME function is used to add a specified time interval to a given time value. It takes two arguments: the initial time value and the time interval to be added. The function returns a new time value after adding the specified interval. Syntax Here is the basic syntax of the ADDTIME function: ADDTIME(time_value, - [MySQL ADDDATE](https://www.mysqltutor.com/mysql-adddate/) - The MySQL ADDDATE function is a date and time function that allows you to add a specified time interval to a date or datetime value. This function is particularly useful when you need to perform calculations involving date and time in your MySQL queries. Syntax The syntax for the ADDDATE function is as follows: ADDDATE(date, - [MySQL DATEDIFF](https://www.mysqltutor.com/mysql-datediff/) - The MySQL DATEDIFF function is a useful tool for calculating the difference between two dates. It returns the difference in days between two date values, allowing you to determine the gap between them. Syntax The syntax for the DATEDIFF function is as follows: DATEDIFF(date1, date2) Here, date1 and date2 are the two date values you - [MySQL DATE_FORMAT](https://www.mysqltutor.com/mysql-date_format/) - The DATE_FORMAT function in MySQL is a powerful tool for formatting date and time values according to a specified format. This function is particularly useful when you need to present date and time information in a customized way, such as changing the order of elements or including additional text. Syntax Here is the basic syntax - [MySQL SQRT](https://www.mysqltutor.com/mysql-sqrt/) - The MySQL SQRT function is used to calculate the square root of a given numeric value. The square root is a mathematical operation that, when applied to a number, yields a result such that, when multiplied by itself, the original number is obtained. In the context of MySQL, the SQRT function provides a convenient way - [MySQL POWER](https://www.mysqltutor.com/mysql-power/) - The MySQL POWER function is a mathematical function that raises a specified number to the power of another number. It is often used to perform exponential calculations. The syntax of the POWER function is as follows: Syntax POWER(base, exponent) Here, "base" is the number that will be raised to the power of "exponent." The function - [MySQL ABS](https://www.mysqltutor.com/mysql-abs/) - The ABS function in MySQL is a mathematical function that stands for "absolute value." Its primary purpose is to return the absolute value of a numeric expression. The absolute value of a number is its distance from zero on the number line, regardless of its direction. In other words, it gives the positive value of - [MySQL FLOOR](https://www.mysqltutor.com/mysql-floor/) - The MySQL FLOOR function is a mathematical function used to round a numeric value down to the nearest integer that is less than or equal to the original value. It is particularly useful when you want to discard the decimal part of a number and obtain the largest integer that is less than or equal - [MySQL CEIL](https://www.mysqltutor.com/mysql-ceil/) - In MySQL, the CEIL function is used to return the smallest integer value that is greater than or equal to a specified numeric expression or column. It rounds up the given value to the nearest integer greater than or equal to the original value. The CEIL function is particularly useful when you need to ensure - [MySQL ROUND](https://www.mysqltutor.com/mysql-round/) - The MySQL ROUND function is used to round a numeric value to a specified number of decimal places. This function is particularly useful when dealing with numerical data and you need to control the precision of your results. Syntax Here is the basic syntax of the ROUND function: ROUND(number, [decimal_places]) number: The numeric value that - [MySQL LOWER](https://www.mysqltutor.com/mysql-lower/) - The MySQL LOWER function is a built-in string function that is used to convert all characters in a given string to lowercase. This function is particularly useful in scenarios where you want to perform case-insensitive comparisons or searches on textual data. Syntax Here's the basic syntax of the LOWER function: LOWER(string) string: This is the - [MySQL UPPER](https://www.mysqltutor.com/mysql-upper/) - The MySQL UPPER function is a built-in string function that is used to convert all the characters in a given string to uppercase. This function is particularly useful when you want to standardize the case of characters in a string for comparison or display purposes. Syntax The syntax for the UPPER function is straightforward: UPPER(str) - [MySQL LENGTH](https://www.mysqltutor.com/mysql-length/) - In MySQL, the LENGTH function is used to determine the length of a string. The length is defined as the number of characters in a string, including spaces and special characters. The syntax for the LENGTH function is quite straightforward: Syntax LENGTH(str) Here, str is the string whose length you want to calculate. It can - [MySQL SUBSTRING](https://www.mysqltutor.com/mysql-substring/) - The SUBSTRING function in MySQL is used to extract a substring from a given string. It allows you to specify the starting position (index) and the length of the substring you want to extract. Syntax The basic syntax of the SUBSTRING function is as follows: SUBSTRING(str, start, length) str: This is the input string from - [MySQL CONCAT](https://www.mysqltutor.com/mysql-concat/) - The CONCAT function in MySQL is used to concatenate two or more strings into a single string. It allows you to combine the values of multiple columns or literal strings together. It's a versatile function that can be used for various data manipulation tasks, including: String concatenation: CONCAT effectively combines multiple strings into a single - [MySQL Data types](https://www.mysqltutor.com/mysql-data-types/) - MySQL supports a variety of data types that allow you to store different types of information in your databases. These data types are crucial for defining the structure of your tables and ensuring the integrity of your data. MySQL data types are an essential aspect of database design, defining the nature of the data that - [MySQL JSON](https://www.mysqltutor.com/mysql-json/) - MySQL introduced the JSON data type to provide native support for storing and manipulating JSON (JavaScript Object Notation) data in a relational database. JSON is a lightweight data interchange format commonly used for representing structured data. With the JSON data type in MySQL, you can store, index, and query JSON documents more efficiently. Benefits of - [MySQL GEOMETRY](https://www.mysqltutor.com/mysql-geometry/) - The MySQL GEOMETRY data type is a spatial data type used to represent geometric objects such as points, lines, and polygons. It is part of MySQL's spatial extensions, which provide support for spatial data and spatial indexing. The GEOMETRY data type is used to store spatial data in a compact binary format. Introduction Here are - [MySQL LINESTRING](https://www.mysqltutor.com/mysql-linestring/) - The LINESTRING data type in MySQL is part of the Spatial Data Types introduced to support spatial and geometric data in a relational database. It is specifically designed for storing and working with linear geometries, such as lines or linear paths, in a two-dimensional space. This feature is part of the MySQL Spatial Extensions, which - [MySQL POINT](https://www.mysqltutor.com/mysql-point/) - The MySQL POINT data type is a spatial data type that represents a single point in a two-dimensional Cartesian coordinate system. It is commonly used in geographic information systems (GIS) and other applications that involve the storage and manipulation of spatial data. The POINT data type is part of MySQL's spatial extensions, which provide support - [MySQL SET](https://www.mysqltutor.com/mysql-set/) - The MySQL SET data type is a string data type that can store zero or more values from a predefined set of values. This data type is often used to store a collection of categories or keywords that apply to a specific entity. For instance, a table that stores product information might use the SET - [MySQL ENUM](https://www.mysqltutor.com/mysql-enum/) - The MySQL ENUM data type is a column type that allows you to define a set of possible values for a column. It is particularly useful when a column should only have a limited, predefined set of values, and you want to restrict the data to those specific options. ENUM stands for "enumerated" and is - [MySQL TINYINT](https://www.mysqltutor.com/mysql-tinyint/) - MySQL TINYINT is a data type used to store integer values that are small in size. It is a 1-byte integer data type, which means it can store values in the range of -128 to 127 for signed TINYINT and 0 to 255 for unsigned TINYINT. The TINYINT data type is commonly used when you - [MySQL BOOLEAN](https://www.mysqltutor.com/mysql-boolean/) - MySQL does not have a dedicated BOOLEAN data type. Instead, MySQL historically represents boolean values using the TINYINT data type. However, it's essential to note that the BOOLEAN data type was introduced in MySQL 8.0.3 and later versions to provide a more intuitive and standard way to handle boolean values. Here's a brief overview of - [MySQL YEAR](https://www.mysqltutor.com/mysql-year/) - MySQL has a data type called YEAR that is specifically designed to store and represent year values. This data type is useful when you need to store and retrieve years without the need for month or day information. The YEAR data type can store values in the range of 1901 to 2155, with the additional - [MySQL DATETIME](https://www.mysqltutor.com/mysql-datetime/) - The DATETIME data type in MySQL is used to store date and time values in a combined format. It is a fundamental data type that allows you to represent a specific point in time with both date and time components. The DATETIME format is 'YYYY-MM-DD HH:MM:SS', where: YYYY represents the four-digit year. MM represents the - [MySQL TIME](https://www.mysqltutor.com/mysql-time/) - The TIME data type in MySQL is used to store and represent time values. It allows you to store time information without a date component. This data type is particularly useful when you need to store and manipulate time-based data, such as the duration of an event, the time of day, or the execution time - [MySQL BLOB](https://www.mysqltutor.com/mysql-blob/) - In MySQL, the BLOB (Binary Large Object) data type is used to store binary data, such as images, audio, video, or any other type of raw binary information. BLOBs can store large amounts of data, and they are suitable for handling files or content that cannot be easily represented as plain text. There are four - [MySQL VARBINARY](https://www.mysqltutor.com/mysql-varbinary/) - MySQL VARBINARY is a data type that stores variable-length binary data. It is similar to the VARCHAR data type, but while VARCHAR is used for storing variable-length character strings, VARBINARY is specifically designed for storing binary data. This can include images, audio, video, or any other type of binary information. Here are some key features - [MySQL BINARY](https://www.mysqltutor.com/mysql-binary/) - The MySQL BINARY data type is a fixed-length binary string type that stores binary data as a sequence of bytes. Unlike the variable-length binary string type VARBINARY, which can store binary data of varying lengths, the BINARY type requires a fixed length to be specified when defining a column. Here are some key characteristics and - [MySQL TEXT](https://www.mysqltutor.com/mysql-text/) - In MySQL, the TEXT data type is used to store large amounts of textual data. It is a versatile data type that can store variable-length character strings. The TEXT type comes in several variations, each designed to accommodate different sizes of text. These variations include TINYTEXT, TEXT, MEDIUMTEXT, and LONGTEXT. Here's an overview of each - [MySQL VARCHAR](https://www.mysqltutor.com/mysql-varchar/) - The VARCHAR data type in MySQL is commonly used to store variable-length character strings. The acronym VARCHAR stands for Variable Character. Unlike fixed-length character types such as CHAR, which reserve a fixed amount of storage regardless of the actual data length, VARCHAR dynamically adjusts its storage based on the length of the data it contains. - [MySQL CHAR](https://www.mysqltutor.com/mysql-char/) - The CHAR data type in MySQL is used to store fixed-length strings. When you define a column with the CHAR data type, you specify a fixed length for the string, and any shorter values are padded with spaces to meet that length. This ensures that the stored data always occupies the specified number of characters. - [MySQL SMALLINT](https://www.mysqltutor.com/mysql-smallint/) - In MySQL, the SMALLINT data type is used to store integer values within a specified range. It is a fixed-point data type, which means that it stores whole numbers without any decimal places. The SMALLINT data type occupies 2 bytes of storage and can store values ranging from -32,768 to 32,767 (signed) or 0 to - [MySQL BIGINT](https://www.mysqltutor.com/mysql-bigint/) - The BIGINT data type in MySQL is used to store integer values that are larger than the range supported by the INT data type. It is an extension of the INT data type and can store 64-bit signed integers, allowing for a significantly larger range of values. The BIGINT data type is commonly used when - [MySQL MEDIUMINT](https://www.mysqltutor.com/mysql-mediumint/) - In MySQL, the MEDIUMINT data type is used to store integer values within a specific range. It is a fixed-width integer type that occupies 3 bytes of storage. This means that it can represent a range of values larger than the smaller TINYINT and SMALLINT types, but smaller than the INT type. The MEDIUMINT type - [MySQL NUMERIC](https://www.mysqltutor.com/mysql-numeric/) - In MySQL, the NUMERIC data type is used to store numeric values with precision and scale. It is often used for representing fixed-point numbers where precision is critical. The NUMERIC data type is synonymous with DECIMAL in MySQL, and both can be used interchangeably. Here's a breakdown of the key characteristics of the NUMERIC data - [MySQL DOUBLE](https://www.mysqltutor.com/mysql-double/) - In MySQL, the DOUBLE data type is used to store double-precision floating-point numbers. It is a numeric data type that can represent a wide range of values with a high degree of precision. Double-precision means that these numbers are stored with twice the precision of the FLOAT data type. DOUBLE key points Here are some - [MySQL FLOAT](https://www.mysqltutor.com/mysql-float/) - The MySQL FLOAT data type is a numeric data type used to store single-precision floating-point numbers. Floating-point numbers are those that have a decimal point or are expressed in exponential notation. The FLOAT data type is commonly used when precision is not a critical concern, and storage efficiency is important. Here are some key characteristics - [MySQL DECIMAL](https://www.mysqltutor.com/mysql-decimal/) - The DECIMAL data type in MySQL is used to store fixed-point numbers, also known as decimal numbers or exact numeric values. It is commonly employed to store monetary and financial data where precision is crucial. Unlike the FLOAT and DOUBLE data types, which are approximate numeric types, DECIMAL provides exact numeric storage with a fixed - [MySQL INT](https://www.mysqltutor.com/mysql-int/) - The MySQL INT data type is a fundamental numeric data type used to store whole numbers (integers). It stands for integer and is commonly employed to represent values without decimal points. The INT data type in MySQL has a fixed size and supports both positive and negative integers. INT introduction Here are some key characteristics - [MySQL CASE](https://www.mysqltutor.com/mysql-case/) - In MySQL, the CASE statement is a powerful conditional expression that allows you to perform conditional logic within SQL queries. It provides a way to perform different actions based on different conditions, similar to the IF-THEN-ELSE structure in other programming languages. The CASE statement can be used in various SQL clauses, including SELECT, WHERE, ORDER - [MySQL IF-THEN-ELSE](https://www.mysqltutor.com/mysql-if-then-else/) - In MySQL, the IF-THEN-ELSE statement is used to control the flow of a program or a query based on a specified condition. It is commonly employed within stored procedures, triggers, and functions to perform conditional logic. Syntax The basic syntax of the IF-THEN-ELSE statement in MySQL is as follows: IF condition THEN -- statements to - [MySQL Joins](https://www.mysqltutor.com/mysql-joins/) - MySQL joins are essential operations in relational databases that allow you to combine rows from two or more tables based on related columns. Joins enable you to retrieve data from multiple tables in a single query, providing a way to establish connections and relationships between different sets of information. There are several types of joins - [MySQL EXCEPT](https://www.mysqltutor.com/mysql-except/) - The MySQL EXCEPT operator is a set operation that returns rows that are present in the first result set but not in the second result set. It is similar to the UNION operator, which returns rows that are present in any of the result sets, but the EXCEPT operator only returns rows that are unique - [MySQL UNION](https://www.mysqltutor.com/mysql-union/) - The UNION operator in MySQL is used to combine the result sets of two or more SELECT statements into a single result set. This can be useful when you want to retrieve and display data from multiple tables or queries as if it were coming from a single source. Syntax The basic syntax for using - [MySQL UNION ALL](https://www.mysqltutor.com/mysql-union-all/) - The UNION ALL is a SQL operator used in database queries to combine the result sets of two or more SELECT statements. Unlike the UNION operator, which removes duplicate rows from the combined result set, UNION ALL includes all rows, including duplicates. This means that if a row appears in more than one SELECT statement, - [MySQL EXISTS](https://www.mysqltutor.com/mysql-exists/) - The EXISTS keyword in MySQL is used in conjunction with a subquery to test for the existence of rows returned by the subquery. It is often employed in the context of a conditional statement or a WHERE clause to filter results based on the presence or absence of records in a specified subquery. Syntax Here's - [MySQL Subquery](https://www.mysqltutor.com/mysql-subquery/) - A subquery in MySQL is a query nested within another query, allowing you to retrieve data from one or more tables based on the results of another query. Subqueries are enclosed in parentheses and can be used in various parts of a SQL statement, such as SELECT, FROM, WHERE, and HAVING clauses. Here are the - [MySQL ROLLUP](https://www.mysqltutor.com/mysql-rollup/) - The ROLLUP is a powerful and flexible feature in MySQL used for generating subtotals and grand totals in result sets. It is particularly useful when working with aggregated data to obtain a hierarchical summary. This feature is commonly employed in data warehousing and business intelligence applications where summarizing data at various levels is a common - [MySQL HAVING](https://www.mysqltutor.com/mysql-having/) - The MySQL HAVING clause is used in conjunction with the GROUP BY clause to filter the results of a query based on the aggregated values. While the WHERE clause is used to filter individual rows before they are grouped and aggregated, the HAVING clause is used to filter the results after they have been grouped - [MySQL GROUP BY](https://www.mysqltutor.com/mysql-group-by/) - The GROUP BY is a clause in the SQL language, and when used with the SELECT statement, it is used to group rows that have the same values in specified columns into summary rows. This is particularly useful when you want to perform aggregate functions, such as counting, summing, averaging, or finding the maximum/minimum values, - [MySQL AVG](https://www.mysqltutor.com/mysql-avg/) - The MySQL AVG function is an aggregate function that is used to calculate the average value of a numeric column within a specified table. This function is particularly useful when you want to obtain the average of a set of values, such as grades, prices, or any other numerical data stored in a MySQL database. - [MySQL MIN](https://www.mysqltutor.com/mysql-min/) - The MySQL MIN function is an aggregate function that is used to retrieve the minimum value from a set of values. It is commonly used with numerical or date columns in a SELECT statement to find the smallest value in a specified column. Here is a basic syntax of the MIN function: SELECT MIN(column_name) FROM - [MySQL MAX](https://www.mysqltutor.com/mysql-max/) - The MySQL MAX function is a built-in aggregate function that is used to find the maximum value within a set of values. It is often employed in conjunction with the SELECT statement to retrieve the highest value from a specified column or a combination of columns in a table. The MAX function is particularly useful - [MySQL SUM](https://www.mysqltutor.com/mysql-sum/) - The MySQL SUM function is an aggregate function that is used to calculate the sum of values in a numeric column. It is commonly used in conjunction with the GROUP BY clause to perform calculations on grouped data. Here is an overview of the SUM function in MySQL: Syntax The basic syntax of the SUM - [MySQL COUNT](https://www.mysqltutor.com/mysql-count/) - The COUNT is a SQL aggregate function used to count the number of rows in a result set or the number of occurrences of a particular value in a column. It is commonly used in conjunction with the SELECT statement to retrieve information about the data stored in a MySQL database. Here's a basic overview - [MySQL SELF JOIN](https://www.mysqltutor.com/mysql-self-join/) - A SELF-JOIN in MySQL occurs when a table is joined with itself. This can be useful in scenarios where you want to compare rows within the same table or establish relationships between rows based on certain conditions. A self-join is typically used when you have a hierarchical structure or when you need to compare related - [MySQL CROSS JOIN](https://www.mysqltutor.com/mysql-cross-join/) - The CROSS JOIN in MySQL is a type of join operation that combines each row from one table with every row from another table. Unlike other join types, such as INNER JOIN or LEFT JOIN, CROSS JOIN doesn't require any matching criteria between the tables. It simply generates the Cartesian product of the two tables - [MySQL RIGHT JOIN](https://www.mysqltutor.com/mysql-right-join/) - A RIGHT JOIN in MySQL is a type of join operation that combines rows from two tables based on a specified condition, and it returns all the rows from the right table (the second table mentioned in the query) and the matched rows from the left table (the first table mentioned in the query). If - [MySQL LEFT JOIN](https://www.mysqltutor.com/mysql-left-join/) - A LEFT JOIN in MySQL is a type of join operation that combines rows from two or more tables based on a specified condition and includes unmatched rows from the left table. This means that even if there is no match in the right table, all the rows from the left table will still be - [MySQL INNER JOIN](https://www.mysqltutor.com/mysql-inner-join/) - In MySQL, an INNER JOIN is a type of join operation that combines rows from two or more tables based on a related column between them. The result set includes only the rows that have matching values in the specified columns. Syntax The basic syntax of an INNER JOIN is as follows: SELECT columns FROM - [MySQL IS NULL](https://www.mysqltutor.com/mysql-is-null/) - In MySQL, the IS NULL condition is used to check whether a specific column in a table contains a NULL value. NULL is a special marker in the database that indicates the absence of data in a particular field. It is not the same as an empty string or zero; rather, it represents the lack - [MySQL LIMIT](https://www.mysqltutor.com/mysql-limit/) - In the context of MySQL, the LIMIT clause is used to constrain the number of rows returned by a query. It is particularly useful when dealing with large datasets, as it allows you to retrieve only a specified number of rows from the result set. Syntax The basic syntax of the LIMIT clause is as - [MySQL LIKE](https://www.mysqltutor.com/mysql-like/) - The MySQL LIKE operator is a powerful tool for searching and retrieving data from database tables based on pattern matching. It is commonly used in conjunction with the SELECT statement to filter rows that match a specified pattern within a specified column. The LIKE operator is particularly useful when you need to perform wildcard searches - [MySQL BETWEEN](https://www.mysqltutor.com/mysql-between/) - The MySQL BETWEEN operator is a logical operator that is used to filter the results of a query based on a specified range of values. It is commonly employed in the WHERE clause of a SELECT statement to retrieve rows with values falling within a particular range. Syntax The basic syntax of the BETWEEN operator - [MySQL NOT IN](https://www.mysqltutor.com/mysql-not-in/) - The NOT IN operator in MySQL is a powerful tool used in SQL queries to filter records based on a specified list of values. It is the negation of the IN operator and is used to exclude rows where the specified value matches any value in a given list. The basic syntax of the NOT - [MySQL IN](https://www.mysqltutor.com/mysql-in/) - The MySQL IN operator is a powerful and convenient tool used in SQL queries to simplify the process of searching for values within a specified range or set. It allows you to specify multiple values in a WHERE clause, making the query more concise and readable. The IN operator is particularly useful when you want - [SELECT DISTINCT](https://www.mysqltutor.com/select-distinct/) - The SELECT DISTINCT statement in MySQL is used to retrieve unique values from a specified column or combination of columns in a table. It is particularly useful when you want to eliminate duplicate rows from the result set. Syntax Here's the basic syntax of the SELECT DISTINCT statement: SELECT DISTINCT column1, column2, ... FROM table_name; - [MySQL FROM](https://www.mysqltutor.com/mysql-from/) - The FROM clause in MySQL is an essential component of a SQL (Structured Query Language) statement, particularly in the context of the SELECT statement. It specifies the table or tables from which the data will be retrieved or manipulated. The basic syntax of a SELECT statement with the FROM clause is as follows: Syntax SELECT - [MySQL ORDER BY](https://www.mysqltutor.com/mysql-order-by/) - The ORDER BY clause in MySQL is a powerful SQL statement that allows you to sort the result set of a query based on one or more columns. This clause is particularly useful when you want to present your query results in a specific order, whether it be ascending or descending. Syntax The basic syntax - [MySQL OR](https://www.mysqltutor.com/mysql-or/) - The MySQL OR clause is a logical operator that allows you to combine multiple conditions in a query, where at least one of the conditions must be true for a record to be included in the result set. This clause is often used in conjunction with the WHERE clause to create more complex and flexible - [MySQL AND](https://www.mysqltutor.com/mysql-and/) - The AND clause in MySQL is a logical operator used to combine multiple conditions in a SQL query. It allows you to retrieve data from a database table based on multiple conditions, and all conditions specified in the AND clause must be true for a row to be included in the result set. Syntax Here's - [MySQL DELETE](https://www.mysqltutor.com/mysql-delete/) - The DELETE statement in MySQL is used to remove one or more records from a table based on a specified condition. This statement allows you to delete specific rows that meet certain criteria, or you can delete all the records in a table without specifying any conditions. Here's a basic syntax for the DELETE statement: - [MySQL UPDATE](https://www.mysqltutor.com/mysql-update/) - The MySQL UPDATE statement is used to modify the existing records in a table. It allows you to change the values of one or more columns in a set of rows based on a specified condition. Here's the basic syntax for the UPDATE statement: Syntax UPDATE table_name SET column1 = value1, column2 = value2, ... - [MySQL WHERE](https://www.mysqltutor.com/mysql-where/) - The WHERE clause in MySQL is a powerful and essential component of SQL queries. It allows you to filter the rows retrieved from a table based on specified conditions. This clause is commonly used in conjunction with SELECT, UPDATE, DELETE, and INSERT statements to narrow down the results or specify the affected rows. Here's a - [MySQL SELECT](https://www.mysqltutor.com/mysql-select/) - The SELECT statement in MySQL is fundamental to querying and retrieving data from a database. It is one of the most commonly used SQL commands and provides a versatile way to interact with databases. Here's an overview of the SELECT statement in MySQL: Basic Syntax SELECT column1, column2, ... FROM table_name WHERE condition; SELECT: Specifies - [MySQL INSERT](https://www.mysqltutor.com/mysql-insert/) - The INSERT statement in MySQL is used to add new records (rows) into a table. It is a fundamental component of database manipulation and is commonly used to populate tables with data. Here is the basic syntax for the INSERT statement: Syntax INSERT INTO table_name (column1, column2, column3, ...) VALUES (value1, value2, value3, ...); Let's - [MySQL CREATE TABLE](https://www.mysqltutor.com/mysql-create-table/) - In MySQL, the CREATE TABLE statement is used to create a new table in a database. This statement allows you to define the table's structure by specifying the columns, their data types, and any constraints or properties associated with each column. Syntax Here is a basic syntax for creating a table: CREATE TABLE table_name ( - [Database](https://www.mysqltutor.com/database/) - MySQL is a popular open-source relational database management system (RDBMS) that is widely used for managing and organizing large sets of data. It is known for its performance, reliability, and ease of use. In MySQL, you can perform various operations on databases, including creating, modifying, and dropping databases. Let's delve into these operations: Create Database ## Pages - [MySQL tutorial](https://www.mysqltutor.com/) - MySQL is an open-source relational database management system (RDBMS) that is widely used for managing and organizing structured data. Developed by MySQL AB, now owned by Oracle Corporation, MySQL is known for its speed, reliability, and ease of use, making it a popular choice for businesses, web developers, and individuals alike. Key Features Relational Database: - [Privacy Policy](https://www.mysqltutor.com/privacy-policy/) - Privacy Policy: Your Data, Your Trust Welcome to https://www.mysqltutor.com/! We understand the importance of privacy, and we want you to feel secure while using our platform. Our Privacy Policy is designed to provide clarity on how we collect, process, and protect your personal information. What Information We Collect: We only collect data that is essential ## Categories - [MySQL](https://www.mysqltutor.com/category/mysql-articles/) - Learn MySQL Tutorial