如何在postgres里使用order by排序

时间:2024-10-12 20:26:37

1、打开命令行模式,sudo su postgres,psql,这样可以进行postgres。

如何在postgres里使用order by排序
如何在postgres里使用order by排序

2、\l查看数据库,然后\c可以切换到相应数据库。

如何在postgres里使用order by排序

3、\dt查看存在表格。

如何在postgres里使用order by排序

4、SELECT * FROM person;查看一下表格的数据。

如何在postgres里使用order by排序

5、SELECT * FROM person ORDER BY country_of_birth;这样可以排序查看。

如何在postgres里使用order by排序

6、SELECT * FROM person ORDER BY countr鲻戟缒男y_of_birth ASC这样可以升序查看。

如何在postgres里使用order by排序

7、SELECT * FROM person ORDER BY countr鲻戟缒男y_of_birth DESC这样可以降序查看。

如何在postgres里使用order by排序
© 手抄报圈