sqlsql基础知识。(代码片段)

author author     2023-01-09     591

关键词:

UPDATE table_name
SET column1=value1,column2=value2,...
WHERE some_column=some_value;
SELECT column1, column2, ...
FROM table1, table2
WHERE condition1, condition2, ...

SELECT table1.column1, table1.column2, table2.column1, ...
FROM table1
JOIN table2
ON table1.t1_id = table2.t1_id
WHERE contidion1, condition2, ...

SELECT table1.column1, table1.column2, table2.column1, table3.column2
FROM table1
JOIN table2
ON table1.t1_id = table2.t1_id
JOIN table3
ON table2.t2_id = table3.t2_id
WHERE contidion1, condition2, ...
SELECT * 
FROM table1

SELECT column1, column2, ...
FROM table1

SELECT column1, column2, ...
FROM table1
WHERE condition(s)

SELECT DISTINCT column1, column2, ...
FROM table1

SELECT column1, column2, ...
FROM table1
ORDER BY column1, column2, ... DESC

SELECT column1 AS alias1, column2 AS alias2, ...
FROM table1

SELECT column1, column2, COUNT(*)
FROM table1
GROUP BY column1, column2

SELECT column1, SUM(column2)
FROM table1
GROUP BY column1

SELECT column1, column2, AVG(column3)
FROM table1
GROUP BY column1, column2                   # Equivalent (and less error-prone): GROUP BY 1, 2

SELECT column1, column2, ...
FROM table1
GROUP BY 1, 2, ...                          # We need to group by each column we select and don't aggregate
HAVING condition1, condition2, ...          # We can't call WHERE in aggregate functions (to test the result of aggregation)
INSERT INTO table
(column1, column2, ... )
VALUES
(expression1, expression2, ... );

INSERT INTO table
(column1, column2, ... )
SELECT expression1, expression2, ...
FROM source_tables
WHERE conditions;
DELETE FROM table_name
WHERE some_column=some_value;

sqlsql基础知识。(代码片段)

查看详情

sqlsql片段(代码片段)

查看详情

sqlsql其他片段(代码片段)

查看详情

sqlsql(代码片段)

查看详情

sqlsql(代码片段)

查看详情

sqlsql(代码片段)

查看详情

sqlsql(代码片段)

查看详情

sqlsql(代码片段)

查看详情

sqlsql(代码片段)

查看详情

sqlsql代码集(代码片段)

查看详情

sqlsql里面的代码片段(代码片段)

查看详情

sqlsql查询(代码片段)

查看详情

sqlsql合集(代码片段)

查看详情

sqlsql替换(代码片段)

查看详情

sqlsql选择(代码片段)

查看详情

sqlsql加密(代码片段)

查看详情

sqlsql:更换(代码片段)

查看详情

sqlsql函数。(代码片段)

查看详情