//create database on lemuria //add one function at a time //hire3, load, list1, approve,drop,add, //admit,withdraw, enroll,cancel,give,roster,BUILT //schedule // //index is registration http://lemuria.cis.vtc.edu/~ktookey/register/registration.html createdb Register24 psql -d Register24 ALTER ROLE ktookey WITH PASSWORD 'frenchfry'; if needed: DROP TABLE tableName; \q Create whatever table you need. CREATE TABLE Counter( count NUMERIC(3) PRIMARY KEY ); Test any SQL commands you will be using: CREATE TABLE Student ( studentID int, studentName char(40) ); INSERT INTO Student (studentID, studentName) VALUES (1, 'Flintstone, Fred'); INSERT INTO Student (studentID, studentName) VALUES (2, 'Rubble, Barney'); CREATE TABLE Faculty ( facultyID char(10), facultyName char(40) ); INSERT INTO Faculty (facultyID, facultyName) VALUES ('krt08260', 'Tookey, KR'); INSERT INTO Faculty (facultyID, facultyName) VALUES ('jfs04290', 'Skoda, Jack'); CREATE TABLE Advise ( facultyID char(10), studentID int ); INSERT INTO Advise (facultyID, studentID) VALUES ('krt08260', 1); INSERT INTO Advise (facultyID, studentID) VALUES ('jfs04290', 2); CREATE TABLE Course ( discipline char(4), number char(4), title char(20) ); INSERT INTO Course (discipline, number, title) VALUES ('CSC', '1152', 'DB by Web'); CREATE TABLE Section ( discipline char(4), number char(4), section char(1), term char(10), meets char(10), location char(10) ); INSERT INTO Section (discipline, number, section, term, meets, location) VALUES ('CIS', '1152', '1', 'S22', 'TuTh1:00', 'Cyberspace'); CREATE TABLE Teach ( discipline char(4), number char(4), section char(1), term char(10), facultyID char(10) ); INSERT INTO Teach (discipline, number, section, term, facultyID) VALUES ('CIS', '1152', '1', 'S24', 'krt08260'); CREATE TABLE Enroll ( discipline char(4), number char(4), section char(1), term char(10), studentID int ); INSERT INTO Enroll (discipline, number, section, term, studentID) VALUES ('CIS', '1152', '1', 'S24', 1); INSERT INTO Enroll (discipline, number, section, term, studentID) VALUES ('CIS', '1152', '1', 'S24', 2); SELECT * FROM Student; SELECT * FROM Enroll INNER JOIN Student ON Enroll.studentID = Student.studentID; SELECT * FROM Faculty INNER JOIN Teach ON Teach.facultyID = Faculty.facultyID; SELECT * FROM (Enroll INNER JOIN Student ON Enroll.studentID = Student.studentID) NATURAL JOIN (Faculty INNER JOIN Teach ON Teach.facultyID = Faculty.facultyID); SELECT discipline, number, facultyName, studentName FROM (Enroll INNER JOIN Student ON Enroll.studentID = Student.studentID) NATURAL JOIN (Faculty INNER JOIN Teach ON Teach.facultyID = Faculty.facultyID); SELECT discipline, number, facultyName, studentName FROM ((Enroll INNER JOIN Student ON Enroll.studentID = Student.studentID) NATURAL JOIN (Faculty INNER JOIN Teach ON Teach.facultyID = Faculty.facultyID)) WHERE Faculty.facultyID = 'krt08260'; SELECT discipline, number, facultyName, studentName FROM ((Enroll INNER JOIN Student ON Enroll.studentID = Student.studentID) NATURAL JOIN (Faculty INNER JOIN Teach ON Teach.facultyID = Faculty.facultyID)) WHERE Faculty.facultyID = 'krt08260' ORDER BY number; //SELECT column_name(s) FROM table_name //SELECT * FROM table_name //https://www.w3schools.com/sql/default.asp //SELECT Orders.OrderID, Customers.CustomerName, Orders.OrderDate //FROM Orders //INNER JOIN Customers ON Orders.CustomerID=Customers.CustomerID; //Create, insert, delete, update, delete