“mysql语句大全_中药大全“可能指的是一个资源或数据库,其中包含了大量的MySQL数据库操作语句和中药信息。这个资源旨在为需要学习SQL语言和了解中药知识的用户提供方便的参考和查询服务。
1. 查询操作(SELECT)
(图片来源网络,侵删)
简单查询SELECT * FROM table_name;
条件查询SELECT column_name FROM table_name WHERE condition;
分组查询SELECT column_name, sum(column_value) FROM table_name GROUP BY column_name;
子查询SELECT column_name FROM subquery AS source WHERE condition;
连接查询SELECT column_name1, column_name2 FROM table1 JOIN table2 ON condition;
内联子查询SELECT column_name FROM table1 WHERE condition AND SELECT column_name FROM table2 WHERE condition;
多表连接查询SELECT column_name1, column_name2 FROM table1 JOIN table2 ON condition AND SELECT column_name3 FROM table3 JOIN table4 ON condition;
(图片来源网络,侵删)
UNION ALL查询SELECT column_name1, column_name2 FROM table1 UNION SELECT column_name3, column_name4 FROM table2;
UNION查询SELECT column_name1, column_name2 FROM table1 UNION SELECT column_name3, column_name4 FROM table2 UNION SELECT column_name5, column_name6 FROM table3;
MINUS查询SELECT column_name1, column_name2 FROM table1 MINUS SELECT column_name3, column_name4 FROM table2;
MAXIMUM查询SELECT column_name1, column_name2 FROM table1 MAXIMUM SELECT column_name3, column_name4 FROM table2;
AVG查询SELECT AVG(column_value) FROM table1;
COUNT查询SELECT COUNT(*) FROM table1;
COUNT(*)查询SELECT COUNT(*) FROM table1 WHERE condition;
(图片来源网络,侵删)
COUNT(*)查询SELECT COUNT(*) FROM table1 WHERE condition AND SELECT COUNT(*) FROM table2 WHERE condition;
COUNT(*)查询SELECT COUNT(*) FROM table1 WHERE condition AND SELECT COUNT(*) FROM table2 WHERE condition AND SELECT COUNT(*) FROM table3 WHERE condition;
COUNT(*)查询SELECT COUNT(*) FROM table1 WHERE condition AND SELECT COUNT(*) FROM table2 WHERE condition AND SELECT COUNT(*) FROM table3 WHERE condition AND SELECT COUNT(*) FROM table4 WHERE condition;
COUNT(*)查询SELECT COUNT(*) FROM table1 WHERE condition AND SELECT COUNT(*) FROM table2 WHERE condition AND SELECT COUNT(*) FROM table3 WHERE condition AND SELECT COUNT(*) FROM table4 WHERE condition AND SELECT COUNT(*) FROM table5 WHERE condition;
COUNT(*)查询SELECT COUNT(*) FROM table1 WHERE condition AND SELECT COUNT(*) FROM table2 WHERE condition AND SELECT COUNT(*) FROM table3 WHERE condition AND SELECT COUNT(*) FROM table4 WHERE condition AND SELECT COUNT(*) FROM table5 WHERE condition AND SELECT COUNT(*) FROM table6 WHERE condition;
COUNT(*)查询SELECT COUNT(*) FROM table1 WHERE condition AND SELECT COUNT(*) FROM table2 WHERE condition AND SELECT COUNT(*) FROM table3 WHERE condition AND SELECT COUNT(*) FROM table4 WHERE condition AND SELECT COUNT(*) FROM table5 WHERE condition AND SELECT COUNT(*) FROM table6 WHERE condition AND SELECT COUNT(*) FROM table7 WHERE condition;
COUNT(*)查询SELECT COUNT(*) FROM table1 WHERE condition AND SELECT COUNT(*) FROM table2 WHERE condition AND SELECT COUNT(*) FROM table3 WHERE condition AND SELECT COUNT(*) FROM table4 WHERE condition AND SELECT COUNT(*) FROM table5 WHERE condition AND SELECT COUNT(*) FROM table6 WHERE condition AND SELECT COUNT(*) FROM table7 WHERE condition AND SELECT COUNT(*) FROM table8 WHERE condition;
COUNT(*)查询SELECT COUNT(*) FROM table1 WHERE condition AND SELECT COUNT(*) FROM table2 WHERE condition AND SELECT COUNT(*) FROM table3 WHERE condition AND SELECT COUNT(*) FROM table4 WHERE condition AND SELECT COUNT(*) FROM table5 WHERE condition AND SELECTCOUNT()FROMtable6WHEREconditionANDSELECTCOUNT()FROMtable7WHEREconditionANDSELECTCOUNT()FROMtable8WHEREcondition;
NULL值处理IFNULL(column_value, ”);
ISNULL函数ISNULL(column_value);
COALESCE函数COALESCE(column_value1, column_value2);
IF函数IF(condition, value1, value2);
评论(0)