This chapter gives you the syntax of all the Apache Derby SQL statements.
All the statements start with any of the keywords like SELECT, INSERT, UPDATE, DELETE, ALTER, DROP, CREATE, USE, SHOW and all the statements end with a semicolon (;).
The SQL statements of Apache Derby are case in sensitives including table names.
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
TRUNCATE TABLE table_name;
ALTER TABLE table_name ADD COLUMN column_name column_type;
ALTER TABLE table_name ADD CONSTRAINT constraint_name constraint (column_name);
ALTER TABLE table_name DROP COLUMN column_name;
ALTER TABLE table_name DROP CONSTRAINT constraint_name;
SELECT * from table_name WHERE condition; or, DELETE from table_name WHERE condition; or, UPDATE table_name SET column_name = value WHERE condition;
SELECT column1, column2, . . . table_name GROUP BY column1, column2, . . .;
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;