ACCESS数据库中常见的SQL语句教程
1.创建表
```
CREATE TABLE table_name
column1 datatype,
column2 datatype,
column3 datatype,
...
```
2.删除表
```
DROP TABLE table_name;
```
3.插入数据
```
INSERT INTO table_name (column1, column2, column3, ...)
VALUES (value1, value2, value3, ...);
```
4.更新数据
```
UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;
```
5.删除数据
```
DELETE FROM table_name
WHERE condition;
```
6.查询数据
```
SELECT column1, column2, ...
FROM table_name
WHERE condition;
```
7.查询数据(排序)
```
SELECT column1, column2, ...
FROM table_name
ORDER BY column_name ASC,DESC;
```
8.查询数据(限制结果集)
```
SELECT column1, column2, ...
FROM table_name
LIMITn;
```
9.查询数据(连接表)
```
SELECT column_name(s)
FROM table1
INNER JOIN table2
lumn_name = lumn_name;
```
10.查询数据(条件连接)
```
SELECT column_name(s)
FROM table1, table2
WHERE condition;
```
11.查询数据(分组)
```
SELECT column_name(s)
FROM table_name
GROUP BY column_name;
```
12.查询数据(函数)access常见条件表达式
```
SELECT COUNT(column_name)
FROM table_name;
```
13.查询数据(子查询)
```
SELECT column_name(s)
FROM table_name
WHERE column_name IN (subquery);
```
14.查询数据(合计)
```
SELECT column_name(s), SUM(column_name)
FROM table_name
GROUP BY column_name;
```
15.查询数据(嵌套)
```
SELECT column_name(s)
FROM table_name
WHERE column_name IN (SELECT column_name FROM table_name WHERE condition);
```
以上是一些常见的SQL语句,对于ACCESS数据库而言,这些语句都可以使用。
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论