table-cyclist-expenses
BEGIN BATCH
INSERT INTO cycling.cyclist_expenses (
cyclist_name, expense_id, amount, description, paid
) VALUES (
'Vera ADRIAN', 2, 13.44, 'Lunch', true
);
INSERT INTO cycling.cyclist_expenses (
cyclist_name, expense_id, amount, description, paid
) VALUES (
'Vera ADRIAN', 3, 25.00, 'Dinner', false
);
UPDATE cycling.cyclist_expenses SET balance = -32.95
WHERE cyclist_name = 'Vera ADRIAN' IF balance = -7.95;
APPLY BATCH;
BEGIN BATCH
INSERT INTO cycling.cyclist_expenses (
cyclist_name, expense_id
) VALUES (
'Joe WALLS', 1
)
IF NOT EXISTS;
INSERT INTO cycling.cyclist_expenses (
cyclist_name, expense_id, amount, description, paid
) VALUES (
'Joe WALLS', 1, 8, 'burrito', false
);
APPLY BATCH;
BEGIN BATCH
INSERT INTO cycling.cyclist_expenses (
cyclist_name, expense_id, amount, description, paid
) VALUES (
'John SMITH', 3, 15.00, 'Lunch', false
);
INSERT INTO cycling.cyclist_name (
id, lastname, firstname
) VALUES (
6ab09bec-e68e-48d9-a5f8-97e6fb4c9b12, 'SMITH', 'John'
);
APPLY BATCH;
BEGIN BATCH
UPDATE cycling.cyclist_expenses SET balance = 0
WHERE cyclist_name = 'Vera ADRIAN' IF balance = -32.95;
UPDATE cycling.cyclist_expenses SET paid = true
WHERE cyclist_name = 'Vera ADRIAN' AND expense_id = 1 IF paid = false;
UPDATE cycling.cyclist_expenses SET paid = true
WHERE cyclist_name = 'Vera ADRIAN' AND expense_id = 3 IF paid = false;
APPLY BATCH;
BEGIN BATCH USING TIMESTAMP 1481124356754405
INSERT INTO cycling.cyclist_expenses (
cyclist_name, expense_id, amount, description, paid
) VALUES (
'Vera ADRIAN', 2, 13.44, 'Lunch', true
);
INSERT INTO cycling.cyclist_expenses (
cyclist_name, expense_id, amount, description, paid
) VALUES (
'Vera ADRIAN', 3, 25.00, 'Dinner', true
);
APPLY BATCH;
BEGIN BATCH
INSERT INTO cycling.cyclist_expenses (
cyclist_name, balance
) VALUES (
'Vera ADRIAN', 0
) IF NOT EXISTS;
INSERT INTO cycling.cyclist_expenses (
cyclist_name, expense_id, amount, description, paid
) VALUES (
'Vera ADRIAN', 1, 7.95, 'Breakfast', false
);
APPLY BATCH;
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Anna VAN DER BREGGEN',1,50,'dinner');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Anna VAN DER BREGGEN',2,50,'lunch');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Michael MATTHEWS',3,25,'lunch');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Michael MATTHEWS',4,25,'lunch');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Alex FRAME',5,40,'lunch');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Alex FRAME',6,40,'dinner');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Steven KRUIKSWIJK',7,20,'lunch');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Steven KRUIKSWIJK',8,39,'dinner');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Marianne VOS',9,20,'lunch');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Marianne VOS',10,20,'dinner');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Paolo TIRALONGO',11,10,'dinner');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Paolo TIRALONGO',12,10,'dinner');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Anna VAN DER BREGGEN',13,50,'dinner');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Anna VAN DER BREGGEN',14,25,'lunch');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Anna VAN DER BREGGEN',15,35,'dinner');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Anna VAN DER BREGGEN',16,20,'lunch');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Anna VAN DER BREGGEN',17,70,'dinner');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Anna VAN DER BREGGEN',18,10,'lunch');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Anna VAN DER BREGGEN',19,50,'dinner');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Anna VAN DER BREGGEN',20,25,'lunch');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Anna VAN DER BREGGEN',21,35,'dinner');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Anna VAN DER BREGGEN',22,20,'lunch');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Anna VAN DER BREGGEN',23,70,'dinner');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Paolo TIRALONGO',24,10,'lunch');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Paolo TIRALONGO',25,11,'dinner');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Paolo TIRALONGO',26,12,'lunch');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Paolo TIRALONGO',27,13,'lunch');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Paolo TIRALONGO',28,14,'lunch');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Paolo TIRALONGO',29,15,'dinner');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Paolo TIRALONGO',30,16,'lunch');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Paolo TIRALONGO',31,17,'dinner');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Paolo TIRALONGO',32,18,'breakfast');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Steven KRUIKSWIJK',33,3,'coffee');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Steven KRUIKSWIJK',34,3,'coffee');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Steven KRUIKSWIJK',35,3,'coffee');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Steven KRUIKSWIJK',36,3,'coffee');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Steven KRUIKSWIJK',37,3,'coffee');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Steven KRUIKSWIJK',38,3,'coffee');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Steven KRUIKSWIJK',39,3,'coffee');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Michael MATTHEWS',40,25,'lunch');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Michael MATTHEWS',41,25,'lunch');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Michael MATTHEWS',42,25,'lunch');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Michael MATTHEWS',43,25,'lunch');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Michael MATTHEWS',44,25,'lunch');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Michael MATTHEWS',45,25,'lunch');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Michael MATTHEWS',46,25,'lunch');
INSERT INTO cycling.cyclist_expenses (cyclist_name,expense_id,amount,description) VALUES ('Michael MATTHEWS',47,25,'lunch');
EXPAND OFF
EXPAND ON
SELECT * FROM cycling.cyclist_expenses;
SELECT * FROM cycling.cyclist_expenses;
SELECT * FROM cycling.cyclist_expenses;
SELECT * FROM cycling.cyclist_expenses;
SELECT
cyclist_name, expense_id,
amount, WRITETIME(amount),
description, WRITETIME(description),
paid, WRITETIME(paid)
FROM cycling.cyclist_expenses WHERE cyclist_name = 'Vera ADRIAN';
SELECT * FROM cycling.cyclist_expenses;
CREATE TABLE IF NOT EXISTS cycling.cyclist_expenses (
cyclist_name text,
balance float STATIC,
expense_id int,
amount float,
description text,
paid boolean,
PRIMARY KEY (cyclist_name, expense_id)
);
DELETE FROM cycling.cyclist_name
WHERE id = 6ab09bec-e68e-48d9-a5f8-97e6fb4c9b12;
DESCRIBE TABLE cycling.cyclist_expenses;
DROP TABLE IF EXISTS cycling.cyclist_expenses;
TRUNCATE TABLE cycling.cyclist_expenses;
UPDATE cycling.cyclist_expenses SET balance = -7.95
WHERE cyclist_name = 'Vera ADRIAN' IF balance = 0;
Was this helpful?
Thank you for your
feedback.