Database operations
Creating a database
$ sudo -u postgres psql
postgres=# create database webclient;
postgres=# create user webclient;
postgres=# alter user webclient with encrypted password 'webclient';
postgres=# grant all privileges on database webclient to webclient;
Below are several useful database commands
sudo -u postgres psql
postgres=# \l
- lists all databases
postgres=# \c webclient
- selects ‘webclient’ database
webclient=# \dt
- shows a list of tables
webclient=# select * from camera;
- shows all cameras
webclient=# select "name" from "user" where id=17;
- shows name for user with ID 17
webclient=# update "user" set name='ABC' where id=17;
- changes name for user with ID 17