MySQL
keyboard_arrow_down 295 guides
chevron_leftMySQL
Common questions2 topics
Cookbooks7 topics
Documentation5 topics
Getting startedAPI referenceRecipes referencecheck_circle
Mark as learned thumb_up
0
thumb_down
0
chat_bubble_outline
0
Comment auto_stories Bi-column layout
settings
MySQL | API reference
schedule Aug 10, 2023
Last updated local_offer
Tags MySQL
tocTable of Contents
expand_more Master the mathematics behind data science with 100+ top-tier guides
Start your free 7-days trial now!
Start your free 7-days trial now!
Data types
Date and Time
- DATE, DATETIME and TIMESTAMPMySQL's DATE type is used when we do not need to store information about time, while DATETIME and TIMESTAMP types are used for values with both date and time parts.
- MySQL | TIMEMySQL's TIME type is used when we do not need information about the date.
- MySQL | YEARMySQL's YEAR type is used to represent a year value.
- DATE, DATETIME and TIMESTAMP
Numeric
- MySQL | BITMySQL's BIT data type is used to store bit values.
- MySQL | BOOLEANMySQL inherently does not support native Boolean data types. However, MySQL still provides us with the datatypes: BOOLEAN and BOOL, which are just aliases for TINYINT.
- MySQL | DECIMAL and NUMERICIn MySQL, DECIMAL and NUMERIC are collectively referred to as Fixed-Point types. This just means they store exact values with a specific precision, which is particularly important for information such as monetary data.
- MySQL | FLOAT and DOUBLEMySQL's FLOAT and DOUBLE types are used to represent approximate numeric data values. The FLOAT type is for single-precision (4 bytes), while DOUBLE is for double-precision (8 bytes).
- MySQL | TINYINT, SMALLINT, MEDIUMINT, INT, BIGINTThere are a total of 5 integer types offered by MySQL.
- MySQL | BIT
String
- MySQL | BINARY and VARBINARYThe BINARY and VARBINARY types in MySQL are similar to CHAR and VARCHAR but they store binary strings rather than non-binary strings (i.e. byte strings rather than character strings).
- MySQL | BLOBIn order to store binary data such as images in MySQL, we can use one of the following data types: TINYBLOB, BLOB, MEDIUMBLOB, LONGBLOB.
- MySQL | CHAR and VARCHARThe CHAR and VARCHAR types in MySQL are both used to store strings (i.e. text).
- MySQL | TEXTIn order to store text in MySQL, we can use one of the following data types: TINYTEXT, TEXT, MEDIUMTEXT, LONGTEXT.
- MySQL | BINARY and VARBINARY
Functions
Aggregate
- MySQL | AVG methodMySQL's AVG(~) aggregate method returns the average value of the provided numeric input / column.
- MySQL | COUNT methodMySQL's COUNT(~) aggregate method counts the number of returned results.
- MySQL | GROUP_CONCAT methodMySQL's GROUP_CONCAT(~) method concatenates non-NULL values from the same group together.
- MySQL | MAX methodMySQL's MAX(~) aggregate method returns the maximum value from the provided input.
- MySQL | MIN methodMySQL's MIN(~) aggregate method returns the minimum value from the provided input.
- MySQL | STD methodMySQL's STD(~) aggregate method returns the population standard deviation from the provided numeric input.
- MySQL | STDDEV methodMySQL's STDDEV(~) aggregate method returns the population standard deviation from the provided numeric input.
- MySQL | STDDEV_POP methodMySQL's STDDEV_POP(~) aggregate method returns the population standard deviation from the provided numeric input.
- MySQL | STDDEV_SAMP methodMySQL's STDDEV_SAMP(~) aggregate method returns the sample standard deviation from the provided numeric input.
- MySQL | SUM methodMySQL's SUM(~) aggregate method returns the sum of the input expression.
- MySQL | VARIANCE methodMySQL's VARIANCE(~) aggregate method returns the population standard variance from the provided numeric input.
- MySQL | VAR_POP methodMySQL's VAR_POP(~) aggregate method returns the population standard variance from the provided numeric input.
- MySQL | VAR_SAMP methodMySQL's VAR_SAMP(~) aggregate method returns the sample standard variance from the provided numeric input.
- MySQL | AVG method
Date and Time
- MySQL | ADDDATE methodMySQL's ADDDATE(~) method adds the specified time interval to a date or datetime value.
- MySQL | ADDTIME methodMySQL's ADDTIME(~) method adds the specified time interval to a time or datetime value.
- MySQL | CONVERT_TZ methodMySQL's CONVERT_TZ(~) method converts a datetime value from one timezone to another.
- MySQL | CURDATE methodMySQL's CURDATE() method returns the current date in the session time zone.
- MySQL | CURRENT_DATE methodMySQL's CURRENT_DATE() method returns the current date in the session time zone.
- MySQL | CURRENT_TIME methodMySQL's CURRENT_TIME(~) method returns the current time in the session time zone.
- MySQL | CURRENT_TIMESTAMP methodMySQL's CURRENT_TIMESTAMP(~) method returns the current date and time in the configured timezone.
- MySQL | CURTIME methodMySQL's CURTIME(~) method returns the current time in the session time zone.
- MySQL | DATE methodMySQL's DATE(~) method returns the date portion of a given date or datetime expression.
- MySQL | DATEDIFF methodMySQL's DATEDIFF(~) method returns the days difference between two date or datetime values. (i.e. expr1 - expr2)
- MySQL | DATE_ADD methodMySQL's DATE_ADD(~) method adds the specified time interval to a date or datetime value.
- MySQL | DATE_FORMAT methodMySQL's DATE_FORMAT(~) method returns a date or datetime formatted according to the provided format.
- MySQL | DATE_SUB methodMySQL's DATE_SUB(~) method subtracts the specified time interval from a date or datetime value.
- MySQL | DAY methodMySQL's DAY(~) method returns the day portion (1-31) of a given date or datetime. DAY(~) is a synonym for DAYOFMONTH(~).
- MySQL | DAYNAME methodMySQL's DAYNAME(~) method returns the name of the weekday from a given date or datetime.
- MySQL | DAYOFMONTH methodMySQL's DAYOFMONTH(~) method returns the day portion (1-31) of a given date or datetime.
- MySQL | DAYOFWEEK methodMySQL's DAYOFWEEK(~) method returns the weekday index (1-7) of a given date or datetime.
- MySQL | DAYOFYEAR methodMySQL's DAYOFYEAR(~) method returns the day of the year (1-366) of a given date or datetime.
- MySQL | EXTRACT methodMySQL's EXTRACT(~) method extracts the specified portion of a date, time or datetime value.
- MySQL | FROM_DAYS methodMySQL's FROM_DAYS(~) method returns a date from a given number of days since the start of the standard calendar (0000-00-00).
- MySQL | FROM_UNIXTIME methodMySQL's FROM_UNIXTIME(~) method returns a date and time from the input unix timestamp.
- MySQL | GET_FORMAT methodMySQL's GET_FORMAT(~) method will return a format string based on the default formatting style for the input region.
- MySQL | HOUR methodMySQL's HOUR(~) method returns the hour portion of a given time or datetime.
- MySQL | LAST_DAY methodMySQL's LAST_DAY(~) method returns the last day of the month for the provided date / datetime.
- MySQL | LOCALTIME methodMySQL's LOCALTIME(~) method returns the current date and time in the configured timezone.
- MySQL | LOCALTIMESTAMP methodMySQL's LOCALTIMESTAMP(~) method returns the current date and time in the configured timezone.
- MySQL | MAKEDATE methodMySQL's MAKEDATE(~) method creates a date based on the provided year and day of year.
- MySQL | MAKETIME methodMySQL's MAKETIME(~) method returns a time value based on the provided hour, minute and second.
- MySQL | MICROSECOND methodMySQL's MICROSECOND(~) method returns the microseconds portion (0-999999) of a given expression.
- MySQL | MINUTE methodMySQL's MINUTE(~) method returns the minute portion of a given time or datetime.
- MySQL | MONTH methodMySQL's MONTH(~) method returns the month of a given date or datetime in the range 0 - 12.
- MySQL | MONTHNAME methodMySQL's MONTHNAME(~) method returns the name of the month from a given date or datetime.
- MySQL | NOW methodMySQL's NOW(~) method returns the current date and time in the configured timezone.
- MySQL | PERIOD_ADD methodMySQL's PERIOD_ADD(~) method adds the specified number of months to a period (YYMM or YYYYMM).
- MySQL | PERIOD_DIFF methodMySQL's PERIOD_DIFF(~) function returns the months difference between two periods.
- MySQL | QUARTER methodMySQL's QUARTER(~) method returns the quarter of the year for a given date or datetime.
- MySQL | SECOND methodMySQL's SECOND(~) method returns the seconds portion of a given time or datetime.
- MySQL | SEC_TO_TIME methodMySQL's SEC_TO_TIME(~) method converts the provided number of seconds to its equivalent time value.
- MySQL | STR_TO_DATE methodMySQL's STR_TO_DATE(~) method will return a date, time or datetime value from a string and its format.
- MySQL | SUBDATE methodMySQL's SUBDATE(~) method subtracts the specified interval from a date or datetime value.
- MySQL | SUBTIME methodMySQL's SUBTIME(~) method subtracts the specified time interval from a time or datetime value.
- MySQL | SYSDATE methodMySQL's SYSDATE(~) method returns the current date and time in the configured timezone.
- MySQL | TIME methodMySQL's TIME(~) method returns the time from a given time or datetime value.
- MySQL | TIMEDIFF methodMySQL's TIMEDIFF(~) method returns the time difference between two time or datetime values.
- MySQL | TIMESTAMP methodMySQL's TIMESTAMP(~) method returns the input as a datetime value when used with a single argument, and returns the sum of the arguments when used with two arguments.
- MySQL | TIMESTAMPADD methodMySQL's TIMESTAMP_ADD(~) method adds the specified unit interval to a date or datetime value.
- MySQL | TIMESTAMPDIFF methodMySQL's TIMESTAMPDIFF(~) method returns the time difference between two date or datetime expressions in the specified unit. (i.e. datetime_expr2 - datetime_expr1).
- MySQL | TIME_FORMAT methodMySQL's TIME_FORMAT(~) method will return a time formatted according to the provided format.
- MySQL | TIME_TO_SEC methodMySQL's TIME_SEC(~) method converts the provided time value to the equivalent number of seconds.
- MySQL | TO_DAYS methodMySQL's TO_DAYS(~) method returns the number of days since the start of the standard calendar (0000-00-00) from a provided date or datetime.
- MySQL | TO_SECONDS methodMySQL's TO_SECONDS(~) method returns the number of seconds from the start of the standard calendar (0000-00-00) from a provided date/datetime.
- MySQL | UNIX_TIMESTAMP methodMySQL's UNIX_TIMESTAMP(~) method returns a Unix timestamp representing seconds since '1970-01-01 00:00:00' UTC.
- MySQL | UTC_DATE methodMySQL's UTC_DATE() method returns the current date in UTC time zone.
- MySQL | UTC_TIME methodMySQL's CURTIME(~) method returns the current time in the UTC time zone.
- MySQL | UTC_TIMESTAMP methodMySQL's UTC_TIMESTAMP(~) method returns the current date and time in the UTC timezone.
- MySQL | WEEK methodMySQL's WEEK(~) method returns the week number from a given date or datetime.
- MySQL | WEEKDAY methodMySQL's WEEKDAY(~) method returns the weekday index (0-6) of a given date or datetime.
- MySQL | WEEKOFYEAR methodMySQL's WEEKOFYEAR(~) method returns the week number (1 - 53) from a given date or datetime.
- MySQL | YEAR methodMySQL's YEAR(~) method returns the year for a given date or datetime.
- MySQL | YEARWEEK methodMySQL's YEARWEEK(~) method returns the year and week for a date or datetime.
- MySQL | ADDDATE method
Numeric
- MySQL | ABS methodMySQL's ABS(~) method returns the absolute value of the input number.
- MySQL | ACOS methodMySQL's ACOS(~) method computes the arc cosine of the input value.
- MySQL | ASIN methodMySQL's ASIN(~) method computes the arc sine of the input value.
- MySQL | ATAN methodMySQL's ATAN(~) method computes the arc tangent of the input value(s).
- MySQL | ATAN2 methodMySQL's ATAN2(~) method computes the arc tangent of the input values.
- MySQL | CEIL methodMySQL's CEIL(~) method returns the smallest integer greater than or equal to the provided input number.
- MySQL | CEILING methodMySQL's CEILING(~) method returns the smallest integer greater than or equal to the provided input number.
- MySQL | CONV methodMySQL's CONV(~) method converts the input number from one base to another and returns it as a string.
- MySQL | COS methodMySQL's COS(~) method computes the cosine of the argument in radians.
- MySQL | COT methodMySQL's COT(~) method computes the cotangent of the input value in radians.
- MySQL | CRC32 methodMySQL's CRC32(~) method computes a cyclic redundancy check value and returns a 32-bit unsigned value.
- MySQL | DEGREES methodMySQL's DEGREES(~) method converts X radians into degrees and returns it.
- MySQL | EXP methodMySQL's EXP(~) method returns the value of e (base of natural logarithm) raised to the specified power.
- MySQL | FLOOR methodMySQL's FLOOR(~) method returns the largest integer smaller than or equal to the provided input number.
- MySQL | LN methodMySQL's LN(~) method returns the value of the natural (base-e) logarithm of the input number. If we provide an input less than or equal to 0 we will return NULL.
- MySQL | LOG methodMySQL's LOG(~) method returns the specified base logarithm of an input number (X). If we provide an input less than or equal to 0 we will return NULL.
- MySQL | LOG10 methodMySQL's LOG10(~) method returns the base-10 logarithm of the input number. If we provide an input less than or equal to 0 we will return NULL.
- MySQL | LOG2 methodMySQL's LOG2(~) method returns the base-2 logarithm of the input number. If we provide an input less than or equal to 0 we will return NULL.
- MySQL | MOD methodMySQL's MOD(~) method returns the remainder of one number (N) divided by another number (M).
- MySQL | PI methodMySQL's PI() method returns the value of π (pi). The default precision is 7 decimal places, however, the double-precision value is stored internally for calculations.
- MySQL | POW methodMySQL's POW(~) method returns the value of X raised to the power of Y.
- MySQL | POWER methodMySQL's POWER(~) method returns the value of X raised to the power of Y.
- MySQL | RADIANS methodMySQL's RADIANS(~) method converts the input degrees into radians and returns it.
- MySQL | RAND methodMySQL's RAND(~) method returns a random float value between 0 (inclusive) and 1 (exclusive).
- MySQL | ROUND methodMySQL's ROUND(~) method returns the input argument rounded to the specified number of decimal places.
- MySQL | SIGN methodMySQL's SIGN(~) method returns the sign of the argument.
- MySQL | SIN methodMySQL's SIN(~) method computes the sine of the input value in radians.
- MySQL | SQRT methodMySQL's SQRT(~) method returns the square root of a nonnegative number.
- MySQL | TAN methodMySQL's TAN(~) method computes the tangent of the input value in radians.
- MySQL | TRUNCATE methodMySQL's TRUNCATE(~) method returns the input number truncated to D decimal places.
- MySQL | ABS method
Regular Expression
- MySQL | REGEXP_INSTR methodMySQL's REGEXP_INSTR(~) method returns the starting index of the substring matching the regular expression (pat).
- MySQL | REGEXP_LIKE methodMySQL's REGEXP_LIKE(~) method returns 1 if the input string matches the regular expression pattern. If there is no match 0 is returned.
- MySQL | REGEXP_REPLACE methodMySQL's REGEXP_REPLACE(~) method returns the input string (expr) with all occurrences that match the regular expression (pat) replaced by the new substring (repl).
- MySQL | REGEXP_INSTR method
String
- MySQL | ASCII methodMySQL's ASCII(~) method returns the ASCII numeric value of the leftmost character in the provided input string.
- MySQL | BIN methodMySQL's BIN(~) method returns a string representation of the binary (base 2 format) of the input number.
- MySQL | BIT_LENGTH methodMySQL's BIT_LENGTH(~) method returns the length of a string in bits.
- MySQL | CHAR methodMySQL's CHAR(~) method returns a binary string representation of the provided integer code values.
- MySQL | CHARACTER_LENGTH methodMySQL's CHARACTER_LENGTH(~) method returns the length of the input string measured in characters. It is synonymous with method CHAR_LENGTH.
- MySQL | CHAR_LENGTH methodMySQL's CHAR_LENGTH(~) method returns the length of the input string measured in characters. It is synonymous with method CHARACTER_LENGTH.
- MySQL | CONCAT methodMySQL's CONCAT(~) method returns a concatenated string from the string inputs.
- MySQL | CONCAT_WS methodMySQL's CONCAT_WS(~) method concatenates input strings using the specified separator.
- MySQL | ELT methodMySQL's ELT(~) method returns the Nth element from the list of provided strings.
- MySQL | EXPORT_SET methodMySQL's EXPORT_SET(~) method returns a string such that for every set bit (bit value 1), we append the specified on string and for every unset bit (bit value 0), we append the specified off string.
- MySQL | FIELD methodMySQL's FIELD(~) method returns the position of a string in a list of strings.
- MySQL | FIND_IN_SET methodMySQL's FIND_IN_SET(~) method returns the position of the first occurrence of a string in a string list.
- MySQL | FORMAT methodMySQL's FORMAT(~) method returns a number formatted with thousands separator and rounded to the specified number of decimal places (D).
- MySQL | FROM_BASE64 methodMySQL's FROM_BASE64(~) method decodes a base64 encoded string and returns the resulting binary string.
- MySQL | HEX methodMySQL's HEX(~) method returns a hexadecimal representation of the input argument.
- MySQL | INSERT methodMySQL's INSERT(~) method inserts and replaces the specified number of characters (len) from a substring (newstr) at the specified position (pos) in the destination string (str).
- MySQL | INSTR methodMySQL's INSTR(~) method returns the position of the first occurrence of a substring in the input string.
- MySQL | LCASE methodMySQL's LCASE(~) method converts the string input to lowercase and returns it.
- MySQL | LEFT methodMySQL's LEFT(~) method returns a substring with the specified number of characters (len) from the left of the input string.
- MySQL | LENGTH methodMySQL's LENGTH(~) method returns the length of a string in bytes.
- MySQL | LOAD_FILE methodMySQL's LOAD_FILE(~) method reads the specified file and returns its contents as a string.
- MySQL | LOCATE methodMySQL's LOCATE(~) method returns the position of the first occurrence of a substring (substr) in the input string (str) starting from the specified position (pos).
- MySQL | LOWER methodMySQL's LOWER(~) method converts the string input to lowercase and returns it.
- MySQL | LPAD methodMySQL's LPAD(~) method returns the string argument, left-padded with the pad string up to a certain length.
- MySQL | LTRIM methodMySQL's LTRIM(~) method returns the input string with leading space characters removed.
- MySQL | MAKE_SET methodMySQL's MAKE_SET(~) method returns a set of comma-separated substrings that have the corresponding bit in the provided bit value(s).
- MySQL | MID methodMySQL's MID(~) method returns a substring from the input string (str) starting at the specified position (pos) with character length (len).
- MySQL | OCT methodMySQL's OCT(~) method returns a string representation of the octal value (base 8) of the input number.
- MySQL | OCTET_LENGTH methodMySQL's OCTET_LENGTH(~) method returns the length of a string in bytes.
- MySQL | ORD methodMySQL's ORD(~) method returns the character code (numeric value) for the leftmost character of the argument.
- MySQL | POSITION methodMySQL's POSITION(~) method returns the position of the first occurrence of a substring in the source string.
- MySQL | QUOTE methodMySQL's QUOTE(~) method returns a string enclosed in single quotation marks that is properly escaped. Each instance of backslash (\), single quote ('), ASCII NUL, and Control Z is preceded by a backslash.
- MySQL | REPEAT methodMySQL's REPEAT(~) method returns the input string repeated count times.
- MySQL | REPLACE methodMySQL's REPLACE(~) method returns the input string (str) with all occurrences of the specified substring (from_str) replaced by the new substring (to_str).
- MySQL | REVERSE methodMySQL's REVERSE(~) method returns the input string with the order of the characters reversed.
- MySQL | RIGHT methodMySQL's RIGHT(~) method returns a substring with the specified number of characters (len) from the right of the input string.
- MySQL | RPAD methodMySQL's RPAD(~) method returns the string argument, right-padded with the pad string up to a certain length.
- MySQL | RTRIM methodMySQL's RTRIM(~) method returns the input string with trailing space characters removed.
- MySQL | SOUNDEX methodMySQL's SOUNDEX(~) method returns a soundex string from the input string.
- MySQL | SPACE methodMySQL's SPACE(~) method returns a string of the specified number of space characters.
- MySQL | STRCMP methodMySQL's STRCMP(~) method compares two strings and returns one of 0, -1, 1 depending on the result of the comparison.
- MySQL | SUBSTR methodMySQL's SUBSTR(~) method returns a substring from the input string starting at the specified position.
- MySQL | SUBSTRING methodMySQL's SUBSTRING(~) method returns a substring from the input string starting at the specified position.
- MySQL | SUBSTRING_INDEX methodMySQL's SUBSTRING_INDEX(~) method returns the substring before the specified number of occurrences of a particular delimiter (delim) in the input source string (str).
- MySQL | TO_BASE64 methodMySQL's TO_BASE64(~) method converts the input string to base64 and returns it as a character string.
- MySQL | TRIM methodMySQL's TRIM(~) method returns the input string with the specified leading and/or trailing string removed.
- MySQL | UCASE methodMySQL's UCASE(~) method converts the input string to uppercase and returns it.
- MySQL | UNHEX methodMySQL's UNHEX(~) method returns a binary string from the hexadecimal string representation. For strings, UNHEX(~) is the inverse of the HEX(~) method.
- MySQL | UPPER methodMySQL's UPPER(~) method converts the input string to uppercase and returns it.
- MySQL | WEIGHT_STRING methodMySQL's WEIGHT_STRING(~) method returns a binary string representing the weight string for the given input.
- MySQL | ASCII method
Operators
- MySQL | ANDMySQL's AND operator can be used in conjunction with a WHERE clause to return values that satisfy all the conditions separated by AND in the WHERE clause.
- MySQL | BETWEENMySQL's BETWEEN operator returns values within a given range. It is inclusive of the start and end values, and it can be used with numbers, strings and dates.
- MySQL | BINARYMySQL's BINARY operator converts an expression to a binary string.
- MySQL | CASEMySQL's CASE operator allows us to add multiple conditions to our query and return a value for the first condition met.
- MySQL | DIVMySQL's DIV operator performs integer division, discarding any fractional part of the division result.
- MySQL | INMySQL's IN operator allows you to combine multiple OR conditions elegantly. If a value is equal to any of the values provided in the IN list it returns 1 (true), otherwise it returns 0 (false).
- MySQL | ISMySQL's IS operator performs a test against a boolean value and returns 1 if the test evaluates to true, 0 otherwise.
- MySQL | IS NOTMySQL's IS NOT operator performs a test against a boolean value and returns 0 if the test evaluates to true, otherwise it returns 1.
- MySQL | IS NOT NULLMySQL's IS NOT NULL operator tests whether a value is not NULL. It returns 1 if the value is not NULL and 0 if the value is NULL.
- MySQL | IS NULLMySQL's IS NULL operator tests whether a value is NULL. It returns 0 if the value is not NULL and 1 if the value is NULL.
- MySQL | LIKEMySQL's LIKE operator can be used to search for values with a particular string pattern. There are two wildcards that we can use with the LIKE operator: % (percent) and _ (underscore).
- MySQL | NOTMySQL's NOT operator can be used in conjunction with a WHERE clause to return values that do not satisfy a particular condition in the WHERE clause.
- MySQL | NOT BETWEENMySQL's NOT BETWEEN operator returns values that are not within a given range. The start and end values are considered part of the range, hence are not included in the result of NOT BETWEEN.
- MySQL | NOT INMySQL's NOT IN operator returns 1 (true) if the value is not equal to any of the values provided in the NOT IN list, otherwise it returns 0 (false).
- MySQL | NOT LIKEMySQL's NOT LIKE operator can be used to search for values that do not match a particular string pattern. There are two wildcards that we can use with the NOT LIKE operator: % (percent) and _ (underscore).
- MySQL | NOT REGEXPMySQL's NOT REGEXP operator returns 1 if the expression string does not match the regular expression pattern. If there is a match 0 is returned.
- MySQL | ORMySQL's OR operator can be used in conjunction with a WHERE clause to return values that satisfy at least one of the conditions separated by OR in the WHERE clause.
- MySQL | REGEXMySQL's REGEXP operator returns 1 if the expression string matches the regular expression pattern. If there is no match 0 is returned.
- MySQL | RLIKEMySQL's RLIKE operator returns 1 if a string (expr) matches the regular expression pattern (pat). If there is no match 0 is returned.
- MySQL | SOUNDS LIKEMySQL's SOUNDS LIKE operator returns 1 if two string expressions sound alike or 0 if they do not.
- MySQL | XORMySQL's XOR operator returns 1 if an odd number of operands is nonzero or 0 if an even number of operands is nonzero. If either operand is NULL we return NULL.
Statements and Clauses
- MySQL | ASMySQL's AS keyword is used to rename or provide an alias for a column or table.
- MySQL | DELETEMySQL's DELETE statement is used to delete existing records in a table.
- MySQL | GROUP BYMySQL's GROUP BY clause allows you to group identical entries in a column into groups. GROUP BY will return one record for each group.
- MySQL | HAVINGMySQL's HAVING clause is used to specify a condition involving aggregate functions. It is used in GROUP BY queries, and specifies a condition upon the grouped results.
- MySQL | INNER JOINThe INNER JOIN clause retrieves rows from both tables where there is a common matching column value.
- MySQL | INSERT INTOMySQL's INSERT INTO statement allows you to add new rows to a table.
- My SQL | LEFT JOINMySQL's LEFT JOIN clause returns all rows from the left table and records that match from the right table. NULL will be used for records that have no matching record in the right table. LEFT JOIN is also referred to as LEFT OUTER JOIN.
- MySQL | LIMITMySQL's LIMIT clause limits the number of returned results.
- MySQL | ORDER BYMySQL's ORDER BY clause sorts the retrieved records and returns them in ascending order by default. We can specify to sort in descending order if needed.
- MySQL | RIGHT JOINMySQL's RIGHT JOIN clause returns all rows from the right table and matching records from the left table. NULL will be used for records that have no matching record in the left table. RIGHT JOIN is also referred to as RIGHT OUTER JOIN.
- MySQL | SELECTMySQL's SELECT statement allows us to retrieve records from a database.
- MySQL | SELECT DISTINCTThe SELECT DISTINCT statement returns values that are distinct.
- MySQL | TRUNCATEMySQL's TRUNCATE statement drops a table and all its records and then recreates it as an empty table. It is similar to a DELETE statement that deletes all rows of a table (i.e. DELETE statement without a WHERE clause).
- MySQL | UNIONMySQL's UNION clause combines the results from multiple SELECT statements into a single result set.
- MySQL | UPDATEThe UPDATE statement is used to modify existing records in a table.
- MySQL | WHEREThe WHERE clause allows us to add conditions to our query. Only records that meet our condition will be retrieved.
Cookbooks
- Difference between HAVING and WHERE in MySQLHAVING specifies what condition should be applied after the aggregation takes place, while WHERE specifies what records are eligible for grouping or aggregation in the first place. If a record does not meet the WHERE condition, it will not even be considered for GROUP BY and HAVING.
- Difference between INNER JOIN, LEFT JOIN and RIGHT JOIN in MySQLMySQL's INNER JOIN clause retrieves rows from both tables where there is a common matching column value. The LEFT JOIN clause returns all rows from the left table and records that match from the right table. NULL will be used for records that have no matching record in the right table. The RIGHT JOIN clause returns all rows from the right table and matching records from the left table. NULL will be used for records that have no matching record in the left table.
- Order By 1 in MySQLThe ORDER BY 1 clause in MySQL translates in plain English to order by the first column selected in the SELECT statement. This syntax is not considered good practice as a change in the order of columns could lead to unintentionally ordering by the wrong column.
- Retrieving a fixed number of rows from a table in MySQLWe can use a LIMIT clause to only retrieve a fixed number of rows from a table in MySQL.
- Retrieving all the data from a table in MySQLThis can be done using the SELECT statement combined with wildcard (*).
- Retrieving columns in a specific order in MySQLThis can be done using the SELECT statement followed by the list of columns you want in the order you want.
- Retrieving distinct records in MySQLIt is possible to retrieve distinct records from a table using the SELECT DISTINCT statement.
- Sorting records in alphabetical order in MySQLWe can retrieve records from a table in alphabetical order in MySQL using the ORDER BY clause.
- Difference between HAVING and WHERE in MySQL
Published by Isshin Inada
Edited by 0 others
Did you find this page useful?
thumb_up
thumb_down
Comment
Citation
Ask a question or leave a feedback...
thumb_up
0
thumb_down
0
chat_bubble_outline
0
settings
Enjoy our search
Hit / to insta-search docs and recipes!