Skip to content

Latest commit

 

History

History
57 lines (38 loc) · 790 Bytes

File metadata and controls

57 lines (38 loc) · 790 Bytes

Postgresql SQL Notes

Creating a database

CREATE DATABASE mydb;

Creating a user

This user can create and delete databases.

CREATE USER brandt PASSWORD 'thatsmarvelous';

or with role

CREATE ROLE brandt WITH PASSWORD 'thatsmarvelous';

Change owner of a database

ALTER DATABASE biglebowski OWNER TO brandt;

Give the user the ability to create databases

ALTER USER brandt CREATEDB;

Making the user a superuser

ALTER USER myuser WITH SUPERUSER;

Change the role of a table

ALTER TABLE my_table OWNER TO newuserrole;

Renaming a table

ALTER TABLE my_table RENAME TO new_table_name;

Set the search path to a schema

SET search_path TO 'qualitymetrics-fss';