SQL 实例

创建于 2024-12-02 / 56
字体: [默认] [大] [更大]

SQL 语法

Select all the records from a specific table ("Customers")

实例解析


SQL SELECT

SELECT Column SELECT *

实例解析


SQL SELECT DISTINCT

SELECT DISTINCT SELECT COUNT(DISTINCT column_name) SELECT COUNT(DISTINCT column_name) workaround for MS Access

实例解析


SQL WHERE

WHERE Clause Text Fields vs. Numeric Fields

实例解析


SQL AND, OR and NOT Operators

AND OR NOT Combining AND, OR and NOT

实例解析


SQL ORDER BY

ORDER BY ORDER BY DESC ORDER BY Several Columns

实例解析


SQL INSERT INTO

INSERT INTO Insert data in specific columns

实例解析



SQL NULL Values

IS NULL Operator IS NOT NULL Operator

实例解析


SQL Update

UPDATE Table UPDATE Multiple Records UPDATE Warning (if you omit the WHERE clause, all records will be updated)

实例解析


SQL DELETE

DELETE DELETE All Records

实例解析


SQL SELECT TOP

SELECT TOP LIMIT SELECT TOP PERCENT SELECT TOP and add a WHERE Clause

实例解析


SQL MIN() and MAX()

MIN() MAX()

实例解析


SQL COUNT, AVG() and SUM()

COUNT() AVG() SUM()

实例解析


SQL LIKE

LIKE - select all table rows starting with "a" LIKE - select all table rows ending with "a" LIKE - select all table rows that have "or" in any position LIKE - select all table rows that have "r" in the second position LIKE - select all table rows that starts with "a" and ends with "o" LIKE - select all table rows that does NOT start with "a"

实例解析


SQL Wildcards

Using the % Wildcard Using the _ Wildcard Using the [charlist] Wildcard Using the [!charlist] Wildcard

实例解析


SQL IN

IN NOT IN

实例解析


SQL BETWEEN

BETWEEN NOT BETWEEN BETWEEN with IN BETWEEN Text Values NOT BETWEEN Text Values

实例解析


SQL Aliases

Alias for Columns Two Aliases Alias for Tables

实例解析


SQL Joins

INNER JOIN LEFT JOIN RIGHT JOIN Self JOIN

实例解析


SQL UNION

UNION UNION ALL UNION With WHERE UNION ALL With WHERE

实例解析


SQL GROUP BY

GROUP BY GROUP BY and ORDER BY GROUP BY With JOIN

实例解析


SQL HAVING

HAVING and GROUP BY HAVING and ORDER BY

实例解析


SQL EXISTS

EXISTS

实例解析


SQL ANY and ALL

ANY ALL

实例解析


SQL INSERT INTO SELECT

INSERT INTO SELECT INSERT INTO SELECT with WHERE

实例解析


SQL CASE

CASE 1 CASE 2

实例解析


SQL Comments

Single Line Comments Single Line Comments At The End Of a Line Multi-line Comments

实例解析


SQL Database

SQL Database tutorials can be found here:

SQL Create DB SQL Drop DB SQL Backup DB SQL Create Table SQL Drop Table SQL Alter Table SQL Constraints SQL Not Null SQL Unique SQL Primary Key SQL Foreign Key SQL Check SQL Default SQL Index SQL Auto Increment SQL Dates SQL Views SQL Injection SQL Hosting


0 人点赞过