FAQ - Databases and SQL

Everything related to database and SQL principles

Recommendations

1) Use lower letters for creating objects in a PostgreSQL database

2) No special characters - No reserved keywords for object names in a database

3) Put comments to all your tables and all your columns

4) Name your primary keys, foreign keys or spatial indices with a constant speaking name pattern

Modelling

In our tree table we have a categorical attribute which is a color component (red, green blue). Shall we write the text values in a text-column or encode the text values with numbers?

SQL Spatial Questions

Which SRID/geometry type have geometries stored in a spatial table?

What is the unit for a specific projection/SRID?

How can I change the table columns' geometry type as well as reproject the geometries stored in the table?

SQL General Questions

Which datatypes should I use for tables in PostgreSQL with PostGIS?

Which column datatypes or subtypes exist in a table?

Can we automatically count up an identification field in a table?

How can I retrieve a limited number of rows in a SELECT Query?

How can I grant or revoke a table to a different user?

How difficult is it to store files in the DB (e.g. .pdf, .docx, .wav or others)?

QGIS connection to PostgreSQL/PostGIS

How can I connect from QGIS to a PostGIS database?

DBeaver

Configure new background to visualize your geometries on top

Other Material

Can a PostreSQL database be accessed via PHP or other programming languages?

Errors