SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
CREATE TABLE IF NOT EXISTS songs ( song_id integer NOT NULL, counter integer NOT NULL, PRIMARY KEY (song_id) ); INSERT INTO songs (song_id, counter ) VALUES (1, 0); INSERT INTO songs (song_id, counter ) VALUES (2, 0); INSERT INTO songs (song_id, counter ) VALUES (3, 0); INSERT INTO songs (song_id, counter ) VALUES (4, 0); INSERT INTO songs (song_id, counter ) VALUES (5, 0); INSERT INTO songs (song_id, counter ) VALUES (6, 0); INSERT INTO songs (song_id, counter ) VALUES (7, 0); INSERT INTO songs (song_id, counter ) VALUES (8, 0); CREATE TABLE IF NOT EXISTS counter ( song_id integer NOT NULL, counter integer NOT NULL, PRIMARY KEY (song_id) ); CREATE type counter_temp2 AS (song_id int, counter int); select json_array_elements('[{"song_id": 1, "counter": 3}, {"song_id": 4, "counter": 4}]') as rndm; select * from json_populate_recordset(null::counter, '[{"song_id": 1, "counter": 3}, {"song_id": 4, "counter": 4}]'); select * from songs INNER JOIN counter ON songs.song_id = counter.song_id;
Stuck with a problem? Got Error? Ask ChatGPT!
Copy Clear