Server [localhost]: Database [postgres]
Download 221.6 Kb. Pdf ko'rish
|
MB
Server [localhost]: Database [postgres]: Port [5432]: Username [postgres]: Пароль пользователя postgres: psql (15.0) ПРЕДУПРЕЖДЕНИЕ: Кодовая страница консоли (866) отличается от основной страницы Windows (1251). 8-битовые (русские) символы могут отображаться некорректно. Подробнее об этом смотрите документацию psql, раздел "Notes for Windows users". Введите "help", чтобы получить справку. postgres=# drop database ttj; DROP DATABASE postgres=# create database ttj; CREATE DATABASE postgres=# \c ttj; Вы подключены к базе данных "ttj" как пользователь "postgres". ttj=# create table talabalar(id serial, familya varchar(25), ism varchar(25), manzil varchar(25)); CREATE TABLE ttj=# create table navbatchilar(id serial, familya varchar(25), ism varchar(25), manzil varchar(25)); CREATE TABLE ttj=# insert into talabalar(familya, ism, manzil) values ('Tlapbayev', 'Ibroxim', 'Chirchiq'); INSERT 0 1 ttj=# insert into talabalar(familya, ism, manzil) values ('Yunusaliyev', 'Jaloliddin', 'Ohangaron'); INSERT 0 1 ttj=# insert into talabalar(familya, ism, manzil) values ('Ashirboyev', 'Alimardon', 'Angren'); INSERT 0 1 ttj=# insert into talabalar(familya, ism, manzil) values ('Aliqulov', 'Begzod', 'Qashqadaryo'); INSERT 0 1 ttj=# insert into talabalar(familya, ism, manzil) values ('Polatov', 'Nurbek', 'Qashqadaryo'); INSERT 0 1 ttj=# insert into navbatchilar(familya, ism, manzil) values('Mamatov', 'Narzillo', 'Namangan'); INSERT 0 1 ttj=# insert into navbatchilar(familya, ism, manzil) values('Uljayeva', 'Shohista', 'Toshkent'); INSERT 0 1 ttj=# insert into navbatchilar(familya, ism, manzil) values('Toirov', 'Shuxrat', 'Toshkent'); INSERT 0 1 ttj=# select * from talabalar; id | familya | ism | manzil ----+-------------+------------+------------- 1 | Tlapbayev | Ibroxim | Chirchiq 2 | Yunusaliyev | Jaloliddin | Ohangaron 3 | Ashirboyev | Alimardon | Angren 4 | Aliqulov | Begzod | Qashqadaryo 5 | Polatov | Nurbek | Qashqadaryo (5 ёЄЁюъ) ttj=# select * from navbatchilar; id | familya | ism | manzil ----+----------+----------+---------- 1 | Mamatov | Narzillo | Namangan 2 | Uljayeva | Shohista | Toshkent 3 | Toirov | Shuxrat | Toshkent (3 ёЄЁюъш) ttj=# select familya from talabalar union select familya from navbatchilar; familya ------------- Yunusaliyev Ashirboyev Mamatov Polatov Uljayeva Aliqulov Toirov Tlapbayev (8 ёЄЁюъ) ttj=# select ism from talabalar union select ism from navbatchilar; ism ------------ Alimardon Ibroxim Shuxrat Jaloliddin Begzod Narzillo Nurbek Shohista (8 ёЄЁюъ) ttj=# select manzil from talabalar union select manzil from navbatchilar; manzil ------------- Ohangaron Qashqadaryo Toshkent Angren Namangan Chirchiq (6 ёЄЁюъ) ttj=# select manzil from talabalar intersect select manzil from navbatchilar; manzil -------- (0 ёЄЁюъ) ttj=# select ism from talabalar intersect select ism from navbatchilar; ism ----- (0 ёЄЁюъ) ttj=# update talabalar set manzil='Toshkent' where id=4; UPDATE 1 ttj=# select * from talabalar; id | familya | ism | manzil ----+-------------+------------+------------- 1 | Tlapbayev | Ibroxim | Chirchiq 2 | Yunusaliyev | Jaloliddin | Ohangaron 3 | Ashirboyev | Alimardon | Angren 5 | Polatov | Nurbek | Qashqadaryo 4 | Aliqulov | Begzod | Toshkent (5 ёЄЁюъ) ttj=# select manzil from talabalar intersect select manzil from navbatchilar; manzil ---------- Toshkent (1 ёЄЁюър) ttj=# update talabalar set ism='Narzillo' where id=5; UPDATE 1 ttj=# select ism from talabalar intersect select ism from navbatchilar; ism ---------- Narzillo (1 ёЄЁюър) ttj=# select familya from talabalar intersect select familya from navbatchilar; familya --------- (0 ёЄЁюъ) ttj=# update talabalar set familya='Toirov' where id=2; UPDATE 1 ttj=# select familya from talabalar intersect select familya from navbatchilar; familya --------- Toirov (1 ёЄЁюър) Download 221.6 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling