TelenkovDmitry hai 1 semana
pai
achega
c5e994caba

+ 58 - 15
.obsidian/workspace.json

@@ -38,6 +38,48 @@
           {
             "id": "4e65549c05eac768",
             "type": "leaf",
+            "state": {
+              "type": "markdown",
+              "state": {
+                "file": "hardcore web development/11. SQL/Дата и время.md",
+                "mode": "source",
+                "source": false
+              },
+              "icon": "lucide-file",
+              "title": "Дата и время"
+            }
+          },
+          {
+            "id": "990ef808e2f4beef",
+            "type": "leaf",
+            "state": {
+              "type": "markdown",
+              "state": {
+                "file": "hardcore web development/11. SQL/SQL настройка.md",
+                "mode": "source",
+                "source": false
+              },
+              "icon": "lucide-file",
+              "title": "SQL настройка"
+            }
+          },
+          {
+            "id": "be93e7f6373f1d1d",
+            "type": "leaf",
+            "state": {
+              "type": "markdown",
+              "state": {
+                "file": "hardcore web development/11. SQL/Псевдонимы.md",
+                "mode": "source",
+                "source": false
+              },
+              "icon": "lucide-file",
+              "title": "Псевдонимы"
+            }
+          },
+          {
+            "id": "9dc8c633db81c6b0",
+            "type": "leaf",
             "state": {
               "type": "markdown",
               "state": {
@@ -78,7 +120,7 @@
             }
           }
         ],
-        "currentTab": 2
+        "currentTab": 5
       }
     ],
     "direction": "vertical"
@@ -149,7 +191,7 @@
       }
     ],
     "direction": "horizontal",
-    "width": 226.5
+    "width": 230.5
   },
   "right": {
     "id": "cf92ccf43e96a53d",
@@ -208,34 +250,37 @@
       "markdown-importer:Импорт Markdown-файлов": false
     }
   },
-  "active": "4e65549c05eac768",
+  "active": "9dc8c633db81c6b0",
   "lastOpenFiles": [
-    "English/Texts/Text 8.md",
+    "todo/Счета.md",
+    "todo/Разное.md",
+    "todo/Задачи по направлениям.md",
+    "proGit.md",
+    "link.md",
+    "hardcore web development/11. SQL/INNER JOIN.md",
+    "hardcore web development/11. SQL/Псевдонимы.md",
+    "hardcore web development/11. SQL/SQL настройка.md",
+    "Pasted image 20250413063157.png",
+    "hardcore web development/11. SQL/Изменение структуры таблиц.md",
+    "hardcore web development/11. SQL/Последовательности.md",
+    "hardcore web development/11. SQL/Дата и время.md",
     "English/Homework/Homework 5.md",
+    "English/Texts/Text 8.md",
     "English/Homework/Homework 1.md",
     "English/Homework",
     "English/words.md",
     "English/Homework/Homework 4.md",
-    "hardcore web development/11. SQL/SQL настройка.md",
     "English/Texts/Text 0.md",
     "English/Texts/Text 7.md",
     "English/Texts",
     "ROTEK/Devlink 070.md",
     "English/Texts/Text 2.md",
-    "hardcore web development/11. SQL/Изменение структуры таблиц.md",
-    "hardcore web development/11. SQL/Дата и время.md",
     "hardcore web development/11. SQL/Задание.md",
     "hardcore web development/11. SQL/Boolean и всякое.md",
     "hardcore web development/11. SQL/Типы данных.md",
     "hardcore web development/11. SQL/Создание таблиц.md",
     "Golang/common.md",
     "hardcore web development/4. Linux.md",
-    "common.md",
-    "English/Homework/Homework 3.md",
-    "todo/Задачи по направлениям.md",
-    "todo/Тренировки и занятия.md",
-    "hardcore web development/11. SQL/Сортировка данных.md",
-    "linux/server.md",
     "configs/gl_wg.conf",
     "configs/Текстовый документ.txt",
     "English/img/20-13.JPEG",
@@ -247,8 +292,6 @@
     "English/img/20-7.JPEG",
     "English/img/20-6.JPEG",
     "English/img/20-5.JPEG",
-    "English/img/20-4.JPEG",
-    "English/Homework/homework 2.md",
     "img/flat",
     "Python/telegram bot",
     "English/img/13-5.JPEG.~tmp",

+ 22 - 0
English/Homework/Homework 5.md

@@ -107,3 +107,25 @@
 6. He is good at gathering mushrooms.
 7. Ann loves cooking, but hates washing up.
 8. The pupil was afraid of being punished for his bad marks.
+
+---
+~={green}4 Read the text and underline the right option=~
+Darwin was born in England in 1809. When he was 22, he left England on a ship called the Beagle. The Beagle was going on a five-year voyage around the coast and islands of South America. Darwin had opportunities to study many of the different species of animals which could be found there. This was why he develop most of his scientific ideas.
+
+~={green}5 Choose and underline the right article, preposition or pronoun.=~
+1. My parents haven't given my money for ages.
+2. His friends are keen (увлечены) in football.
+3. My mum can play the violin very well.
+4. My classmate takes after his father in appearance. (Внешне похож на отца).
+5. "How did you like the film?" she asked.
+6. She seemed to be in a great hurry. (Казалось, она очень торопилась.)
+7. Easter Island is in the Pacific Ocean.
+8. We arrived at the railway station late.
+9. I like these shoes. Try them on (примерять).
+10. The house is surrounded by the forest.
+11. They often gibe me advice.
+12. I can't find my watch anywhere. I've looked for it all over the house.
+13. He left the house without any money.
+14. I can't drink this tea. There's too much sugar in it.
+15. He didn't have any mistakes in the test, but his friend had a few.
+16. Deborah and Sally are friends. They both like skiing and mountain-climbing, but neither of them likes water sports, so they often go on winter holidays together.

BIN=BIN
English/img/23-1.JPEG


BIN=BIN
English/img/23-2.JPEG


BIN=BIN
English/img/23-3.JPEG


BIN=BIN
English/img/23-4.JPEG


+ 0 - 0
hardcore web development/11. SQL/INNER JOIN.md


+ 24 - 7
hardcore web development/11. SQL/SQL настройка.md

@@ -19,7 +19,7 @@ $ psql --version
 # Подключение к серверу через psql
 $ psql -U <user name> -h <host ip> -W -d <data base name>
 
-$ psql rroom -h 94.232.244.161 -W -d rroom_bd
+$ psql rroom -h 94.232.244.161 -W -d rroom_db
 ```
 
 ```sql
@@ -63,18 +63,35 @@ $ psql rroom -h 94.232.244.161 -W -d rroom_bd
 Настройка Postgres на сервере
 https://itproblog.ru/%D0%BF%D0%B5%D1%80%D0%B2%D0%BE%D0%BD%D0%B0%D1%87%D0%B0%D0%BB%D1%8C%D0%BD%D0%B0%D1%8F-%D0%BD%D0%B0%D1%81%D1%82%D1%80%D0%BE%D0%B9%D0%BA%D0%B0-%D1%81%D0%B5%D1%80%D0%B2%D0%B5%D1%80%D0%B0-postgresql/
 
-~={yellow}Команды и всякое=~
+~={green}Команды и всякое=~
 
-Для входа в postgres shell:
+~={yellow}Для входа в postgres shell:=~
 ```bash
 $ sudo -u postgres psql
 ```
-Команды postgres-#
+
+~={yellow}Команды postgres-#=~
 ```bash
 \du - список пользователей
-\l - список баз данных
+\l - список баз данных (\l+ в расширенном виде с размером)
 \q - выйти из postgres shell
+\d - показать таблицы и последовательности
+\dt - показать только таблицы
+\ds - показать только последовательности
+\dt - показать толко индексы
+\du - показать роли
+\duS - показать системные роли
+\h create - сравка по команде (create)
+\copy (SELECT * FROM author) TO '~/authors.csv' WITH CSV HEADER - сохранрить результат запроса в csv файл
+\o ~/ouput.txt - вывод результатов в файл (для выходв из режима команда '\o')
+\html - вывод в формете html
+\e - открыть текстовый редактор для написания дланных запросов
+\x - режим расширенного экрана (для просмотра)
+\s ~/history.sql - сохранить историю в файл
+```
 
-Смена паролья пользователя
+~={yellow}Смена пароля пользователя=~
+```sql
 alter user <user_name> with password 'new password';
-```
+```
+

+ 73 - 0
hardcore web development/11. SQL/Последовательности.md

@@ -0,0 +1,73 @@
+Давайте в `psql` посмотрим описание таблицы `author`. Открываем `` `psql` ``, вводим `\d author`.
+
+```sql
+rroom_db=> \d author
+                                   Table "public.author"
+   Column    |          Type          | Collation | Nullable |           Default
+-------------+------------------------+-----------+----------+------------------------------
+ author_id   | bigint                 |           | not null | generated always as identity
+ name        | character varying(150) |           | not null |
+ description | text                   |           |          |
+Indexes:
+    "author_pkey" PRIMARY KEY, btree (author_id)
+Check constraints:
+    "author_description_check" CHECK (length(description) >= 30)
+    "author_name_check" CHECK (length(name::text) >= 3)
+Referenced by:
+    TABLE "book" CONSTRAINT "book_author_id_fkey" FOREIGN KEY (author_id) REFERENCES author(author_id)
+```
+
+И также давайте посмотрим просто выдачу `\d` по нашей базе данных:
+
+```sql
+rroom_db=> \d
+                     List of relations
+ Schema |             Name              |   Type   | Owner
+--------+-------------------------------+----------+-------
+ public | author                        | table    | rroom
+ public | author_author_id_seq          | sequence | rroom
+ public | book                          | table    | rroom
+ public | book_book_id_seq              | sequence | rroom
+ public | book_category                 | table    | rroom
+ public | book_category_category_id_seq | sequence | rroom
+(6 rows)
+```
+
+Напрямую работать с последовательностью для первичных ключей как правило нет необходимости, но полезно знать, что они существуют и какие возможности дают. Давайте посмотрим информацию по последовательности `book_book_id_seq`:
+
+```sql
+rroom_db=> \d book_book_id_seq
+                      Sequence "public.book_book_id_seq"
+  Type  | Start | Minimum |       Maximum       | Increment | Cycles? | Cache
+--------+-------+---------+---------------------+-----------+---------+-------
+ bigint |     1 |       1 | 9223372036854775807 |         1 | no      |     1
+Sequence for identity column: public.book.book_id
+```
+
+Давайте создадим последовательность и посмотрим, как с ней работать — просто для примера и понимания того, как вы можете с ними работать:
+
+```sql
+CREATE SEQUENCE tmp_seq
+START 1
+MINVALUE 1
+MAXVALUE 9223372036854775807
+INCREMENT BY 1
+CACHE 1
+NO CYCLE;
+
+select nextval('tmp_seq');
+select nextval('tmp_seq');
+select nextval('tmp_seq');
+
+select currval('tmp_seq');
+
+drop sequence tmp_seq;
+```
+
+---
+~={green}Задание=~
+```sql
+create sequence orders_seq;
+select setval('orders_seq', ((to_char(current_timestamp, 'YYYYMMDD')||'000')::bigint));
+```
+

+ 40 - 0
hardcore web development/11. SQL/Псевдонимы.md

@@ -0,0 +1,40 @@
+Действуют только на время запроса.
+
+~={yellow}Псевдоним для подзапроса=~
+```sql
+select * from (
+    select
+        b.book_id,
+        b.name book_name,
+        a.name author_name
+    from book b
+    join author a using(author_id)
+)
+where author_name = 'Михаил Шолохов';
+```
+
+~={yellow}Обращение по псевдониму подзапроса=~
+```sql
+select t.* from (
+    select
+        b.book_id,
+        b.name book_name,
+        a.name author_name
+    from book b
+    join author a using(author_id)
+) as t
+where t.author_name = 'Михаил Шолохов';
+```
+
+~={green}Задание=~
+```sql
+select b.b_data data from foo.bar.bzz b;
+```
+
+b - псевдоним колонки b_data
+b_data - колонка таблицы
+data - псевдоним таблицы bzz
+foo - база данных
+bar - схема
+bzz - таблица
+

+ 18 - 0
todo/Счета.md

@@ -1,4 +1,22 @@
 # 2025
+#### <font color = "MediumSeaGreen">Апрель</font>
+##### <font color = "#1D8571">Коммунальные услуги</font>
+- [ ] Широкая электричество ()
+- [ ] Широкая платежка ()
+- [ ] Подрезково ()
+- [ ] Нина электричество + TKO (717)
+
+##### <font color = "#1D8571">Передача показаний с 15-ого числа</font>
+- [ ] Широкая вода. хол , гор 
+- [ ] Широкая электричество: 
+- [ ] Подрезково: хол , гор , эл  (передал только электричества!)
+- [ ] Химки: 471 - , 473 - , 450 - , 402 - , эл -  (передал только электричества!)
+- [ ] Планерная Нина электричество: 
+- [ ] Планерная Батя электричество: 
+##### <font color = "#1D8571">Дополнительно</font>
+- [ ] Отдать Нине ()
+- [ ] Домашний интернет
+- [ ] Сотовый телефон ()
 #### <font color = "MediumSeaGreen">Март</font>
 ##### <font color = "#1D8571">Коммунальные услуги</font>
 - [x] Широкая электричество ()