Program: db_menu.c
CS-160: Software Engineering
Instructor: Robert Bruce
Spring 2017

This is a command line program that enables the user to select, insert, update, and delete data from a simple Postgres table called students.

The students table is defined as follows:

STUDENTS
student_id bigserial
first_name varchar(100)
last_name varchar(100)

Note: before running this program, you will need to do the following in Postgres:

  • Create a database called cs160 in Postgres
  • Create the students table (above).
  • Modify db_menu.c to utilize your Postgres database password (when you initially create a database handle).

The full source code for db_menu.c is available at http://www.cs.sjsu.edu/~bruce/programs/spring_2017_cs_160_section_3/db_menu/db_menu.c (right mouse click then select "Save link as" to download).

A makefile to compile db_menu.c is available at http://www.cs.sjsu.edu/~bruce/programs/spring_2017_cs_160_section_3/db_menu/Makefile (right mouse click then select "Save link as" to download).

To compile db_menu.c, type make within a shell command prompt in the same directory containining db_menu.c and your Makefile.