$ psql -U pgsql postgres psql (9.6.1) Type "help" for help.
=# CREATE DATABASE sherwood;
CREATE DATABASE
=# CREATE USER brtuck WITH PASSWORD 'fatbelly';
CREATE ROLE
=# GRANT ALL PRIVILEGES ON DATABASE sherwood to brtuck;
GRANT
=# GRANT SELECT ON DATABASE sherwood to brtuck;
GRANT
=# mysql> CREATE TABLE robber
(# ( id integer UNIQUE,
(# name text NOT NULL,
(# weapon_id integer,
(# armor_id integer,
(# CONSTRAINT robber_id_pkey PRIMARY KEY (id));
# \d robber
Table "robber"
Attribute | Type | Modifier
------------+---------+----------
id | integer | not null
name | text | not null
weapon_id | integer |
armor_id | integer |
Index: robber_id_pkey
=# ALTER TABLE robbers
-# ADD birthdate date;
ALTER
=# \d robber
Table "robber"
Attribute | Type | Modifier
-------------+---------+----------
id | integer | not null
name | text | not null
weapon_id | integer |
armor_id | integer |
birthdate | date |
Index: robber_id_pkey
=# DROP TABLE robbers;
DROP DATABASE
=# ALTER TABLE robbers RENAME TO woodfolks;
ALTER
=# ALTER TABLE robbers
-# RENAME COLUMN birthdate TO date_of_birth;
ALTER
mysql: SHOW TABLES
postgresql: \d
postgresql: SELECT table_name FROM information_schema.tables WHERE table_schema = 'public';
mysql: SHOW DATABASES
postgresql: \l
postgresql: SELECT datname FROM pg_database;
mysql: SHOW COLUMNS
postgresql: \d table
postgresql: SELECT column_name FROM information_schema.columns WHERE table_name ='table';
mysql: DESCRIBE TABLE
postgresql: \d+ table
postgresql: SELECT column_name FROM information_schema.columns WHERE table_name ='table';
- HOME
~~~~~~~~~~~~~~~
- OpenBSD
- NetBSD
- FreeBSD
- Linux
- Solaris
- Windows
~~~~~~~~~~~~~~~
- Git
- Ansible
- Atlassian
- Network tools
- Qemu
- Virtualbox
- Vim
- Tmux
- Mutt
- STar
~~~~~~~~~~~~~~~
- MySQL
- PostgreSQL
- Postfix
- OpenSSL
- tcpdump
- SSH
~~~~~~~~~~~~~~~
- Packet Filter
- IP Filter
~~~~~~~~~~~~~~~
- Bash
- web-dev
- Hacking
- LINUX DAYS