Advertisement
Cross09

db_lab6

Jun 24th, 2021
1,008
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 1. Напишите запрос, который выводит всех пациентов, рожденных 3 и 4 октября 2003 с использование оператора IN и оператора BETWEEN.
  2. postgres=# select * from patients where birthdate between '2003-10-03' and '2003-10-04';
  3.  id | name | sex | status | birthdate
  4. ----+------+-----+--------+-----------
  5. (0 rows)
  6.  
  7. 2. Напишите запрос, который выводит всех пациентов, чьи имена начинаются с буквы, попадающей в диапазон от «А» до «Л».
  8. postgres=# select * from patients where name between 'А%' and 'Л%';
  9.  id |            name            | sex |  status  |         birthdate
  10. ----+----------------------------+-----+----------+----------------------------
  11.   1 | Коваленко Денис Сергеевич  | Муж | Учащийся | 2021-06-22 18:28:38.065201
  12.  
  13. 3. Напишите запрос, который выберет всех пациентов, чьи имена начинаются с буквы «К».
  14. postgres=# select * from patients where name like 'К%';
  15.  id |            name            | sex |  status  |         birthdate
  16. ----+----------------------------+-----+----------+----------------------------
  17.   1 | Коваленко Денис Сергеевич  | Муж | Учащийся | 2021-06-22 18:28:38.065201
  18. (1 row)
  19.  
  20. 4. Напишите запрос, который выберет всех врачей, имеющие нулевые значения или пропущенные значения NULL в поле Квалификация.
  21. postgres=# select * from doctors where qualification = null;
  22.  id | name | qualification | specialisation
  23. ----+------+---------------+----------------
  24. (0 rows)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement