# select * from users ;
user_id | login | email | password | firstname | lastname
---------+--------+-------------------------+----------+-----------+----------
1 | katie | [email protected] | secret | Katie | Secret
(1 row)
# select * from forum;
forum_id | forum_name | group_id | forum_parent
----------+------------+----------+--------------
1| 1st forum | 1 | -1
(1 row)
# select * from groups;
group_id | group_name | group_description | group_founder
----------+-----------------------+-------------------------------------------------+---------------
1 | Java programming | System.out.println("Hello world in Java!"); :) | 1
(1 row)
我在我的數據庫中有3個表。我想從中獲得用戶使用id = 1
創建的論壇。這個怎麼做? (在創建這樣的組的用戶的表groups
,id
中被稱爲group_founder
)。如何從3個表中選擇特定數據? [PostgreSQL 9.1]
我的意思是,在上面的輸出中,您可以看到用戶id = 1
創建了一個「Java編程」組,然後在該組內創建了一個名爲「1st forum」的論壇。請幫助:)
@Katie酷.... – DON