drop table enroll;
drop table section;
drop table major;
drop table course;
drop table prof;
drop table dept;
drop table student;

create table student (
	sid integer primary key,
	sname text, 
	sex char,
	age integer,
	year integer,
	gpa numeric
);
	
create table dept (
	dname text primary key,
	numphds integer
);
create table prof (
	pname text primary key,
 	dname text
);

create table course (
	cno integer,
	cname text,
	dname text,
	primary key (dname, cno)
);

create table major (
	dname text,
	sid integer,
	primary key (dname, sid)
);


create table section (
	dname text,
	cno integer,
	sectno integer,
	pname text,
	primary key (dname, cno, sectno)
);

create table enroll (
	sid integer,
	grade numeric,
	dname text,
	cno integer,
	sectno integer,
	primary key (sid, dname, cno, sectno)
);

\copy student from student.data
\copy dept from dept.data
\copy prof from prof.data
\copy course from course.data
\copy major from major.data
\copy section from section.data
\copy enroll from enroll.data

