- Apache Derby 教程
- 阿帕奇德比 - 主页
- Apache Derby - 简介
- Apache Derby - 部署模式
- Apache Derby - 环境设置
- Apache Derby - 工具
- Apache Derby - 语法
- Apache Derby - 数据类型
- Apache Derby - 创建表
- Apache Derby - 删除表
- Apache Derby - 插入数据
- Apache Derby - 检索数据
- Apache Derby - 更新数据
- Apache Derby - 删除数据
- Apache Derby -Where 子句
- Apache Derby - GROUP BY 子句
- Apache Derby - 按条款排序
- Apache Derby -having 子句
- 修改表语句
- Apache Derby - 德比索引
- Apache Derby - 程序
- Apache Derby - 架构
- Apache Derby - 触发器
- Apache Derby 有用资源
- Apache Derby - 快速指南
- Apache Derby - 有用的资源
- Apache Derby - 讨论
Apache Derby - 语法
本章介绍所有 Apache Derby SQL 语句的语法。
所有语句均以任何关键字开头,例如 SELECT、INSERT、UPDATE、DELETE、ALTER、DROP、CREATE、USE、SHOW,并且所有语句均以分号 (;) 结尾。
Apache Derby 的 SQL 语句区分大小写,包括表名。
创建语句
CREATE TABLE table_name ( column_name1 column_data_type1 constraint (optional), column_name2 column_data_type2 constraint (optional), column_name3 column_data_type3 constraint (optional) );
掉落表
DROP TABLE table_name;
插入语句
INSERT INTO table_name VALUES (column_name1, column_name2, ...);
选择语句
SELECT column_name, column_name, ... FROM table_name;
更新声明
UPDATE table_name SET column_name = value, column_name = value, ... WHERE conditions;
删除语句
DELETE FROM table_name WHERE condition;
描述语句
Describe table_name
SQL TRUNCATE TABLE 语句
TRUNCATE TABLE table_name;
ALTER 语句 – 添加列
ALTER TABLE table_name ADD COLUMN column_name column_type;
ALTER 语句 – 添加约束
ALTER TABLE table_name ADD CONSTRAINT constraint_name constraint (column_name);
ALTER 语句 – 删除列
ALTER TABLE table_name DROP COLUMN column_name;
ALTER 语句 – 删除约束
ALTER TABLE table_name DROP CONSTRAINT constraint_name;
WHERE 子句
SELECT * from table_name WHERE condition; or, DELETE from table_name WHERE condition; or, UPDATE table_name SET column_name = value WHERE condition;
GROUP BY 子句
SELECT column1, column2, . . . table_name GROUP BY column1, column2, . . .;
ORDER BY 子句
SELECT * FROM table_name ORDER BY column_name ASC|DESC.
拥有子句
SELECT column1, column2 . . . from table_name GROUP BY column having condition;
创建索引
CTREATE INDEX index_name on table_name (column_name);
创建唯一索引
CREATE UNIQUE INDEX index_name on table_name (column_name);
创建复合索引
CREATE INDEX index_name on table_name (column_name1, column_name2);
显示索引
SHOW INDEXES FROM table_name;
删除索引
DROP INDEX index_name;