Using System Functions in MySQL

Página 59

MySQL is a relational database management system (RDBMS) that uses Structured Query Language (SQL) for data manipulation. One of the notable features of MySQL is its extensive use of system functions to accomplish a variety of tasks. System functions are built-in functions that perform a specific task, such as string manipulation, math, date and time, etc.

The system functions in MySQL are categorized into several categories, including flow control functions, string functions, date and time functions, math functions, comparison functions, aggregate functions, information functions, cryptography, type conversion functions, group functions, user functions, system information functions, system administration functions, etc.

Flow Control Functions

The flow control functions in MySQL are used to control the flow of execution of SQL commands. Some of the common flow control functions include IF, CASE, IFNULL, NULLIF, COALESCE, etc. The IF function is used to test a condition and return one value if the condition is true and another value if the condition is false. The CASE function is used to perform multiple comparisons and return a specific value when the first true comparison is found.

String Functions

The string functions in MySQL are used to manipulate and process strings of text. Some of the common string functions include CONCAT, LENGTH, SUBSTRING, REPLACE, UPPER, LOWER, etc. The CONCAT function is used to concatenate two or more strings. The LENGTH function is used to return the length of a string. The SUBSTRING function is used to extract a part of a string. The REPLACE function is used to replace all occurrences of a substring in a string with another substring.

Date and Time Functions

The datetime functions in MySQL are used to manipulate and process datetime data. Some of the common date and time functions include NOW, CURDATE, CURTIME, DATE, TIME, YEAR, MONTH, DAY, HOUR, MINUTE, SECOND, etc. The NOW function is used to return the current date and time. The CURDATE function is used to return the current date. The CURTIME function is used to return the current time.

Math Functions

The math functions in MySQL are used to perform mathematical operations on numerical data. Some of the common math functions include ABS, CEIL, FLOOR, ROUND, SQRT, POW, LOG, EXP, etc. The ABS function is used to return the absolute value of a number. The CEIL function is used to round a number up to the nearest whole number. The FLOOR function is used to round a number down to the nearest whole number.

Comparison Functions

The comparison functions in MySQL are used to compare two or more values ​​and return a result based on the comparison. Some of the common comparison functions include EQUAL, NOT EQUAL, LESS THAN, GREATER THAN, LESS THAN OR EQUAL, GREATER THAN OR EQUAL, BETWEEN, LIKE, IN, IS NULL, IS NOT NULL, etc.

Aggregation Functions

Aggregation functions in MySQL are used to perform calculations on a set of values ​​and return a single value. Some of the common aggregate functions include COUNT, SUM, AVG, MIN, MAX, etc. The COUNT function is used to count the number of rows in a table. The SUM function is used to sum the values ​​in a column. The AVG function is used to calculate the average of values ​​in a column.

In summary, the system functions in MySQL are an integral part of the RDBMS that facilitate efficient manipulation and processing of data. They are easy to use and provide a powerful way to perform a wide range of tasks on a MySQL database.

Now answer the exercise about the content:

Which of the following statements about system functions in MySQL is correct?

You are right! Congratulations, now go to the next page

You missed! Try again.

Next page of the Free Ebook:

60Introduction to MySQL Shell

Earn your Certificate for this Course for Free! by downloading the Cursa app and reading the ebook there. Available on Google Play or App Store!

Get it on Google Play Get it on App Store

+ 6.5 million
students

Free and Valid
Certificate with QR Code

48 thousand free
exercises

4.8/5 rating in
app stores

Free courses in
video, audio and text