generated from admin/template
Добавлена лаба 1 и 2
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 37 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 34 KiB |
@@ -0,0 +1,17 @@
|
|||||||
|
-- docker run -d --name my-postgres -e POSTGRES_PASSWORD=zivari -e POSTGRES_INITDB_ARGS="--auth-host=md5" -p 5432:5432 postgres:latest
|
||||||
|
|
||||||
|
-- docker exec -it my-postgres psql -U postgres
|
||||||
|
|
||||||
|
CREATE DATABASE dev_db;
|
||||||
|
\c dev_db
|
||||||
|
|
||||||
|
CREATE TABLE users (
|
||||||
|
id SERIAL PRIMARY KEY,
|
||||||
|
name VARCHAR(100) NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO users (name) VALUES ('Alice'), ('Bob');
|
||||||
|
INSERT INTO users (name) VALUES ('Charlie');
|
||||||
|
SELECT * FROM users ORDER BY id;
|
||||||
|
|
||||||
|
-- Host: localhost, Port: 5432, Database: dev_db, User: postgres, Password: zivari
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
-- docker run --name johtho-tcg-server -e POSTGRES_USER=professor_elm -e POSTGRES_PASSWORD=totodile_secret -e POSTGRES_DB=johtho_db -e POSTGRES_INITDB_ARGS="-k" -p 5433:5432 -d postgres:16
|
||||||
|
|
||||||
|
-- Команды выполняются внутри контейнера (docker exec -it johtho-tcg-server bash):
|
||||||
|
-- echo "\setenv PSQL_PAGER 'less -XS'" > /var/lib/postgresql/.psqlrc
|
||||||
|
-- echo "\set PROMPT1 '%n@%/%R%x%# '" >> /var/lib/postgresql/.psqlrc
|
||||||
|
-- echo "\set PROMPT2 '%n@%/%R%x%# '" >> /var/lib/postgresql/.psqlrc
|
||||||
|
-- echo "\timing on" >> /var/lib/postgresql/.psqlrc
|
||||||
|
-- echo "\set find_starter 'SELECT * FROM starter_set.pokemon_cards WHERE hp >= 45;'" >> /var/lib/postgresql/.psqlrc
|
||||||
|
|
||||||
|
\conninfo
|
||||||
|
SHOW data_checksums;
|
||||||
|
SHOW data_directory;
|
||||||
|
|
||||||
|
CREATE SCHEMA starter_set;
|
||||||
|
|
||||||
|
CREATE TABLE starter_set.pokemon_cards (
|
||||||
|
card_id INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
||||||
|
name VARCHAR(100) NOT NULL,
|
||||||
|
hp INT NOT NULL,
|
||||||
|
card_number INT NOT NULL,
|
||||||
|
rarity VARCHAR(50)
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO starter_set.pokemon_cards (name, hp, card_number, rarity) VALUES
|
||||||
|
('Chikorita', 45, 1, 'Common'),
|
||||||
|
('Cyndaquil', 39, 2, 'Common'),
|
||||||
|
('Totodile', 50, 3, 'Common');
|
||||||
|
|
||||||
|
\set find_starter 'SELECT * FROM starter_set.pokemon_cards WHERE hp >= 45;'
|
||||||
|
:find_starter
|
||||||
Reference in New Issue
Block a user