Snippets Collections
grant all privileges on database <dbname> to <username> ;
select pgc.conname as constraint_name,
       ccu.table_schema as table_schema,
       ccu.table_name,
       ccu.column_name,
       pgc.* as definition
from pg_constraint pgc
join pg_namespace nsp on nsp.oid = pgc.connamespace
join pg_class  cls on pgc.conrelid = cls.oid
left join information_schema.constraint_column_usage ccu
          on pgc.conname = ccu.constraint_name
          and nsp.nspname = ccu.constraint_schema
where contype ='c'
order by pgc.conname;
select users.last_login,us.*,users.* from users left join user_school us on us.user_id = users.id where school_id is not null
and last_login between '2021-01-01'::date and '2021-12-31'::date
UPDATE public.users
SET name=concat('User',id), email=concat('user',id,'@email.com')
WHERE name not like '%Testbruker';
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'dojoreads_db',
        'USER': 'postgres',
        'PASSWORD': 'root',
        'HOST': '127.0.0.1',
        'PORT': '5432',
    }
}
star

Wed Jul 07 2021 17:00:07 GMT+0000 (UTC) https://medium.com/coding-blocks/creating-user-database-and-adding-access-on-postgresql-8bfcd2f4a91e

#postgres
star

Mon Jun 14 2021 17:06:09 GMT+0000 (UTC)

#sql #postgres
star

Fri May 28 2021 15:01:34 GMT+0000 (UTC)

#sql #postgres
star

Thu May 27 2021 20:27:23 GMT+0000 (UTC)

#sql #postgres
star

Mon Mar 29 2021 22:20:07 GMT+0000 (UTC)

#python #django #postgres

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension