Search
 
SCRIPT & CODE EXAMPLE
 

SQL

force drop all tables postgres

DROP SCHEMA public CASCADE;
CREATE SCHEMA public;
Comment

how to drop all tables in postgresql

DROP SCHEMA public CASCADE;
CREATE SCHEMA public;

GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO public;
Comment

postgres drop all tables

DO $$ 
  DECLARE 
    r RECORD;
BEGIN
  FOR r IN 
    (
      SELECT table_name 
      FROM information_schema.tables 
      WHERE table_schema=current_schema()
    ) 
  LOOP
     EXECUTE 'DROP TABLE IF EXISTS ' || quote_ident(r.table_name) || ' CASCADE';
  END LOOP;
END $$ ;
Comment

PREVIOUS NEXT
Code Example
Sql :: select all from table left join 
Sql :: selecting specific day in colum sql 
Sql :: how to login to mysql in homestead 
Sql :: oracle disk group space 
Sql :: split string and copy last element postgresql 
Sql :: Inserting data into different tables at once in oracle sql 
Sql :: check if user defined table type exists in sql server 
Sql :: select query in mongodb 
Sql :: Write the order of execution of all the SQL clauses and statements 
Sql :: sql union 
Sql :: postgres insert timestamp without timezone 
Sql :: reindex mssql table 
Sql :: sql join on wildcard 
Sql :: oracle sql trigger select into 
Sql :: order by in codeigniter query builder 
Sql :: change column in mysql 
Sql :: three inner joins sql 
Sql :: WHERE value IS sql 
Sql :: Can you Join two Tables With Common Column? 
Sql :: android sqlite get rows count 
Sql :: initcap in mysql 
Sql :: Concatenate columns in table 
Sql :: Write an SQL query to determine the 5th highest salary without using TOP or limit method. 
Sql :: sql server download for windows 10 64 bit 
Sql :: ignore duplicate rows in sqlite 
Sql :: mysql dump database tables only 
Sql :: les jointures sql server 
Sql :: mysqldump 
Sql :: identity column in sql server 
Sql :: current month transactions in mysql 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =