Here is an example that shows how to make the table creation readable
and understandable.
Another improvement would be to come up with understandable column names
and formulate the query in normal language.
Since I don't know exactly what is the question you are trying to formulate
I am merely shooting in the dark.
-- create a test schema
CREATE SCHEMA TEST;
SET SCHEMA TEST;
-- create a table ticker that represents ....
CREATE TABLE TICKER(ANLDETAIL_WKN VARCHAR(25) PRIMARY KEY);
INSERT INTO PUBLIC.TICKER(ANLDETAIL_WKN) VALUES ('855018'), ('620200');
-- create a table anlkurse that represents ...
CREATE TABLE ANLKURSE(
ANLDETAIL_WKN VARCHAR(25) NOT NULL,
KURS DECIMAL(10, 4) DEFAULT 0,
DATUM DATE NOT NULL
);
ALTER TABLE ANLKURSE ADD CONSTRAINT PUBLIC.CONSTRAINT_1 PRIMARY
KEY(ANLDETAIL_WKN, DATUM);
INSERT INTO PUBLIC.ANLKURSE(ANLDETAIL_WKN, KURS, DATUM) VALUES
('620200', 36.1600, DATE '2012-05-29'),
('855018', 46.4300, DATE '2012-05-29'),
('855018', 45.0000, DATE '2012-05-28'),
('855018', 43.8500, DATE '2012-05-25'),
('855018', 44.0000, DATE '2012-05-24'),
('855018', 42.7900, DATE '2012-05-23'),
('855018', 45.1500, DATE '2012-05-22'),
('855018', 43.0300, DATE '2012-05-21'),
('620200', 35.3600, DATE '2012-05-28'),
('620200', 34.8900, DATE '2012-05-25'),
('620200', 35.5900, DATE '2012-05-24'),
('620200', 35.5000, DATE '2012-05-23'),
('620200', 36.8000, DATE '2012-05-22'),
('620200', 36.0000, DATE '2012-05-21'),
('620200', 35.3300, DATE '2012-05-30'),
('855018', 44.6500, DATE '2012-05-30'),
('620200', 34.6300, DATE '2012-05-31'),
('620200', 34.3400, DATE '2012-06-01'),
('855018', 43.0600, DATE '2012-06-01'),
('840400', 72.8500, DATE '2012-05-31');
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en.