C:\Users\cbw>docker exec -it postgres /bin/bash
root@3d939a692d63:/# ls
bin boot dev docker-entrypoint-initdb.d docker-entrypoint.sh etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
root@3d939a692d63:/# pwd
/
root@3d939a692d63:/# psql -U postgres
psql (13.2 (Debian 13.2-1.pgdg100+1))
Type "help" for help.
postgres=# create user cbw password 'cbw' superuser;
CREATE ROLE
postgres=# create database cbw owner cbw;
CREATE DATABASE
postgres=# \c cbw cbw
You are now connected to database "cbw" as user "cbw".
CREATE TABLE star (
id integer NOT NULL,
name character varying(255),
class character varying(32),
age integer,
radius integer,
lum integer,
magnt integer,
CONSTRAINT star_pk PRIMARY KEY (id)
);
CREATE TABLE
cbw=# \dt
List of relations
Schema | Name | Type | Owner
--------+------+-------+-------
public | star | table | cbw
(1 row)
cbw=# select * from star;
id | name | class | age | radius | lum | magnt
----+------+-------+-----+--------+-----+-------
(0 rows)
cbw=#
'데이터베이스 > Postgresql' 카테고리의 다른 글
[PostgreSQL] 기본 조회 명령어 및 변수 선언, 설정 (0) | 2021.07.16 |
---|---|
[PostgreSQL] 계정/유저관리 (0) | 2021.07.16 |
[PostgreSQL] database 관리(생성/추가/삭제/변경) (0) | 2021.07.16 |
[PostgreSQL] Tablespace 생성 (0) | 2021.07.16 |
Postgresql 테이블스페이스 사용량 조회 (0) | 2021.07.16 |
댓글