H2 DML Operations: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(8 intermediate revisions by the same user not shown)
Line 6: Line 6:


  SELECT * FROM ''<table-name>'' ORDER BY ''<column-name>'';
  SELECT * FROM ''<table-name>'' ORDER BY ''<column-name>'';
SELECT ''<column-name>'', ... FROM ''<table-name>'' ORDER BY ''<column-name>'';


=Insert=
=Insert=


  INSERT INTO ''<table-name>'' VALUES(1, "Hello");
  INSERT INTO ''<table-name>'' VALUES(''<val-for-column-1>'', ''<val-for-column-2>'');
 
INSERT INTO TEST VALUES(1, 'Hello');


This insert command uses the table definition created as an example [[H2_DDL_Operations#Create_Table|here]].
This insert command uses the table definition created as an example [[H2_DDL_Operations#Create_Table|here]].
=Update=
UPDATE ''<table-name>'' SET ''<column-name>''=&#039;''<some-value>''' WERE ''<condition>''
=Delete=
DELETE FROM ''<table-name>'' WERE ''<condition>''

Latest revision as of 19:18, 25 September 2017

Internal

Query

SELECT * FROM <table-name> ORDER BY <column-name>;
SELECT <column-name>, ... FROM <table-name> ORDER BY <column-name>;

Insert

INSERT INTO <table-name> VALUES(<val-for-column-1>, <val-for-column-2>);
INSERT INTO TEST VALUES(1, 'Hello');

This insert command uses the table definition created as an example here.

Update

UPDATE <table-name> SET <column-name>='<some-value>' WERE <condition>

Delete

DELETE FROM <table-name> WERE <condition>