CS 320 - Introduction to PostgreSQL

 


PostgreSQL is the database that we will be using this semester for this course. Documentation, downloads etc can be found at http://www.postgresql.org The documentation also includes descriptions of the SQL commands supported under postgreSQL. The database is running on ww2.cs.lafayette.edu. There is a command line interface to the database called psql.

psql <options> <database>

Database accounts with names and databases will be created for you on tomcat. The accounts have the same name as your Unix login and the passwords will be distributed by email. For example, to connect as xiag, you would use

psql -h tomcat.cs.lafayette.edu -U xiag -W xiag

This connects you to the machine tomcat.cs.lafayette.edu (-h option) as the user xiag (-U option), prompts you for a password (-W option) and then connects you to the database (xiag) when you successfully enter a password.

You should login to the database from any compute server (does not include tomcat) and create a table with a few fields. There are examples of table creation in the online documentation for Postgresql and for standard SQL.