Skip to content

Commit

Permalink
Merge pull request #119 from GuoXiCheng/dev-c
Browse files Browse the repository at this point in the history
update docs
  • Loading branch information
GuoXiCheng authored Nov 5, 2024
2 parents 71e68b6 + 88fccd1 commit e482d07
Show file tree
Hide file tree
Showing 4 changed files with 129 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/.vitepress/sidebars/sqlite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,26 @@
link: /database/sqlite/core-concepts/table-operations#删除列
- text: 删除表
link: /database/sqlite/core-concepts/table-operations#删除表
- text: Insert 语句
link: /database/sqlite/core-concepts/insert-statement
items:
- text: 为指定列插入值
link: /database/sqlite/core-concepts/insert-statement#为指定列插入值
- text: 为所有列插入值
link: /database/sqlite/core-concepts/insert-statement#为所有列插入值
- text: Delete 语句
link: /database/sqlite/core-concepts/delete-statement
items:
- text: 删除所有行
link: /database/sqlite/core-concepts/delete-statement#删除所有行
- text: 删除指定行
link: /database/sqlite/core-concepts/delete-statement#删除指定行
- text: Update 语句
link: /database/sqlite/core-concepts/update-statement
items:
- text: 更新所有行
link: /database/sqlite/core-concepts/update-statement#更新所有行
- text: 更新指定行
link: /database/sqlite/core-concepts/update-statement#更新指定行


35 changes: 35 additions & 0 deletions src/database/sqlite/core-concepts/delete-statement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Delete 语句

Delete 语句用于删除表中已有的记录。

可以使用带有 Where 子句的 Delete 语句删除选定的行,否则所有记录都会被删除。

## 删除所有行

::: code-group

```sql [语法]
DELETE FROM TABLE_NAME;
```

```sql [实例]
DELETE FROM customers;
```

:::

## 删除指定行

::: code-group

```sql [语法]
DELETE FROM TABLE_NAME
WHERE condition;
```

```sql [实例]
DELETE FROM customers
WHERE id = 1;
```

:::
33 changes: 33 additions & 0 deletions src/database/sqlite/core-concepts/insert-statement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Insert 语句

## 为所有列插入值

::: code-group

```sql [语法]
INSERT INTO TABLE_NAME
VALUES (value1, value2, value3, ...);
```

```sql [实例]
INSERT INTO customers
VALUES (1, 'John', 'Doe', '2021-01-01 00:00:00', '2021-01-01 00:00:00');
```

:::

## 为指定列插入值

::: code-group

```sql [语法]
INSERT INTO TABLE_NAME (column1, column2, column3, ...)
VALUES (value1, value2, value3, ...);
```

```sql [实例]
INSERT INTO customers (id, first_name, last_name, created_at, updated_at)
VALUES (1, 'John', 'Doe', '2021-01-01 00:00:00', '2021-01-01 00:00:00');
```

:::
39 changes: 39 additions & 0 deletions src/database/sqlite/core-concepts/update-statement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Update 语句

Update 语句用于更新数据库表中的数据。

可以使用带有 WHERE 子句的 Update 语句来更新特定的行,否则所有行都会被更新。

## 更新所有行

::: code-group

```sql [语法]
UPDATE TABLE_NAME
SET column1 = value1, column2 = value2, ...
```

```sql [实例]
UPDATE customers
SET first_name = 'Jane', last_name = 'Doe';
```

:::

## 更新指定行

::: code-group

```sql [语法]
UPDATE TABLE_NAME
SET column1 = value1, column2 = value2, ...
WHERE condition;
```

```sql [实例]
UPDATE customers
SET first_name = 'Jane', last_name = 'Doe'
WHERE id = 1;
```

:::

0 comments on commit e482d07

Please sign in to comment.