在MySQL中,可以使用各种内置函数来查询和操作数据。以下是一些常用的查询函数和如何使用它们的示例:
SELECT COUNT(*) FROM table_name;
SELECT SUM(column_name) FROM table_name;
SELECT AVG(column_name) FROM table_name;
SELECT MIN(column_name) FROM table_name;
SELECT MAX(column_name) FROM table_name;
SELECT column_name, COUNT(*)
FROM table_name
GROUP BY column_name;
SELECT *
FROM table_name
ORDER BY column_name ASC;
SELECT *
FROM table_name
WHERE column_name = 'value';
SELECT *
FROM table_name
WHERE column_name LIKE '%pattern%';
SELECT *
FROM table1
JOIN table2
ON table1.column_name = table2.column_name;
这些函数和子句可以组合使用,以便更有效地查询和操作MySQL数据库中的数据。