MrTV
asked on
delete table if exist then create table postgres
I have table yourtablename how can Put script to delete table if it exist thwn i can create table
CREATE TABLE yourtablename AS
SELECT sename."Date",
sename.name,
sename."Open",
sename."Low",
sename."Close",
COALESCE(lag(sename."Open") OVER (PARTITION BY sename.name ORDER BY sename.name), sename."Open") AS lag_start,
COALESCE((sename."Open" - lead(sename."Open") OVER (PARTITION BY sename.name ORDER BY sename."Date")), sename."Open") AS chg
FROM sename
ORDER BY sename.name, sename."Date" DESC;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.