Jesse Madsen
If you have never made a database scheme or Table before this is the quick start guide for you. This guide will not teach you database theory, but it will only get you up and going with DBeaver(open source) interface.
Right click postgres-sample and Edit the Connection.
You will get a connection screen, confirming a good connection.
Right click your database and drill down unitl you can create new Schema.
Name the Schema.
Expand your Schema and right click to create new Table.
Name the Table.
Right click on table to Create a New Column.
I am creating my primary key(PK) name ID with a serial(auto-fill number) datatype. Also, because it is a the primary key, I activated the Not Null check.
Now we have our column structure set. Note nothing has been committed/save to the database yet.
I added two more columns to the Table, and now its time to save it.
DBeaver will give you the SQL syntax of the Table creation. Select persist to save the Table
I created another table for the team. The SQL syntax of the new table creation table.
We have created two tables, but they are not connected to each other. On the team table, I made a player_id with the anticipation of connecting the player table with the team table with a foreign key relationship.
No link between them
Double-click the player table to open it back up for editing. We need to lable a constraint(assign which column is the primary key). Open the Constraints tab on the right and right click to create New Constraint.
Set id as our primary key.
Double-click the team table and select the Foreign Keys tab. Right Click in an open area to add New Foreign Key Constraint.
Select the player on the top reference table. Ok, then save changes.
Now the tables are connected.
In this tutorial, we learned how to make tables and connect them with the foreign key relationship. If you have any comments, please leave a reply.
Leave a Reply