SQLize Online / PHPize Online

Share      Blog   Popular
Copy Format Clear
CREATE TABLE marketing.name_of_obj( id NUMERIC, val NUMERIC ); INSERT INTO marketing.name_of_obj SELECT g.x, g.x * 2 FROM generate_series(1, 100, 1) g(x); CREATE TABLE marketing.new_name_of_obj( id NUMERIC, val NUMERIC ); INSERT INTO marketing.new_name_of_obj SELECT * FROM marketing.name_of_obj_old WHERE val < 10; CREATE OR REPLACE VIEW v_view AS SELECT * FROM marketing.name_of_obj; ALTER TABLE marketing.name_of_obj RENAME TO name_of_obj_old; --ALTER TABLE marketing.new_name_of_obj RENAME TO name_of_obj; CREATE OR REPLACE VIEW marketing.name_of_obj AS SELECT * FROM marketing.new_name_of_obj; SELECT * FROM v_view;
Stuck with a problem? Got Error? Ask ChatGPT!