Sql語句大全
以下是一些常見的 SQL 語句:
1. 創建資料庫:
```sql
CREATE DATABASE database_name;
```
2. 刪除資料庫:
```sql
DROP DATABASE database_name;
```
3. 創建表:
```sql
CREATE TABLE table_name (
column1 datatype,
column2 datatype,
column3 datatype,
...
);
```
4. 刪除表:
```sql
DROP TABLE table_name;
```
5. 插入數據:
```sql
INSERT INTO table_name (column1, column2, column3, ...)
VALUES (value1, value2, value3, ...);
```
6. 更新數據:
```sql
UPDATE table_name SET column1 = value1, column2 = value2, ... WHERE condition;
```
7. 查詢數據:
```sql
SELECT column1, column2, ... FROM table_name WHERE condition;
```
8. 篩選數據:
```sql
SELECT column1, column2, ... FROM table_name WHERE condition AND column3 = value;
```
9. 排序數據:
```sql
SELECT column1, column2, ... FROM table_name ORDER BY column1 ASC/DESC;
```
10. 過濾數據:
```sql
SELECT column1, column2, ... FROM table_name WHERE column3 IN (value1, value2, ...);
```
11. 連線表:
```sql
SELECT column1, column2, ... FROM table1 INNER JOIN table2 ON table1.column = table2.column;
```
這只是一些基本的 SQL 語句,SQL 語言非常豐富,還有許多其他功能和語句可以用於數據操作和查詢。
以上就是【Sql語句大全】的相關內容,敬請閱讀。