人大金仓数据库sql语法示例
时间: 2024-10-23 14:00:24 浏览: 144
金仓SQL语法详解
人大金仓数据库(Kingbase)的SQL语法与标准SQL类似,但也有一些特定的功能和命令。这里提供一些基本的SQL语句示例:
1. **连接查询(JOIN)**:
```sql
SELECT t1.column1, t2.column2
FROM table1 t1
INNER JOIN table2 t2 ON t1.common_column = t2.common_column;
```
2. **创建表(CREATE TABLE)**:
```sql
CREATE TABLE employees (
id INT PRIMARY KEY,
name VARCHAR(50),
department_id INT,
hire_date DATE
);
```
3. **插入数据(INSERT)**:
```sql
INSERT INTO employees (id, name, department_id, hire_date)
VALUES (1, '张三', 101, '2021-01-01');
```
4. **查询数据(SELECT)**:
```sql
SELECT * FROM employees WHERE department_id = 101;
```
5. **更新数据(UPDATE)**:
```sql
UPDATE employees SET name = '李四' WHERE id = 1;
```
6. **删除数据(DELETE)**:
```sql
DELETE FROM employees WHERE id = 1;
```
阅读全文