SQL语句(Structured Query Language)是用于与关系型数据库进行交互的语言。下面是几个常用的SQL语句:
-
创建表: CREATE TABLE table_name ( column1 datatype, column2 datatype, column3 datatype, ... );
-
插入数据: INSERT INTO table_name (column1, column2, column3, ...) VALUES (value1, value2, value3, ...);
-
查询数据: SELECT column1, column2, ... FROM table_name WHERE condition;
-
更新数据: UPDATE table_name SET column1 = value1, column2 = value2, ... WHERE condition;
-
删除数据: DELETE FROM table_name WHERE condition;
-
连接表查询: SELECT column1, column2, ... FROM table1 INNER JOIN table2 ON table1.column_name = table2.column_name;
-
排序数据: SELECT column1, column2, ... FROM table_name ORDER BY column_name ASC/DESC;
-
聚合函数: SELECT COUNT(column_name) FROM table_name; SELECT SUM(column_name) FROM table_name; SELECT AVG(column_name) FROM table_name; SELECT MAX(column_name) FROM table_name; SELECT MIN(column_name) FROM table_name;
以上是一些基本的SQL语句,可以用来进行数据库操作。具体的语法和用法可能因不同的数据库管理系统而有所差异,需要根据具体的数据库系统文档进行学习和使用。