# PgAccess Tutorial - Creating a table

## Creating a table

At the right is the window you should see when PgAccess starts up. The first task for most users will be to create a database. Notice the 'buttons' at the left of the main window. Clicking on these allows you to see the names of different objects that are stored in your database, which should be empty at the moment.

Click the Tables and New buttons to bring up the window shown below. This will allow you to specify the structure of the new table. It is important to note that if you haven't specified a database when starting up PgAccess, this table will be created in the database named `<username>`, your username.

Assume that you want to create a table with entries describing bibliographic references in the field of psychology. Choose a table name, such as `psyref` that will be easy to recall and find in a list. Enter the table name in the first input field.

When you already have tables in a database, you can use the Inherits button to toggle a list of existing tables to inherit characteristics of another table. In this example, there should be no previous tables to use.

Enter each field, giving it a name, field type and size, if the field type does not imply the size. That is, if your first field was to be a sequence number, and you selected int2 as the field type, you would not have to specify a field size. However, if your second field was to contain the author of the reference, and was a varchar type, you would have to specify how many characters would be allowed in the field.

As you enter each field, click the Add field button to add it to the list at the right side of the window. You can change the position of fields using the Move field up and Move field down buttons, or delete a field if you decide it isn't what you wanted. When you are finished specifying fields, press the Create table button.

Back to index