Skip to content

Instantly share code, notes, and snippets.

@andrew8088
andrew8088 / prof.sql
Created July 5, 2012 18:51
This is the SQL code to set up a database for a problem I had on a database management exam. Here's the problem: write an SQL query that will return a table of the names and salaries of the professors who teach 20 or more students.
CREATE DATABASE profs;
USE profs;
CREATE TABLE professors (
name varchar(30) NOT NULL,
specialization varchar(20),
salary double(8,2),
CONSTRAINT prof_pk PRIMARY KEY (name));
CREATE TABLE students (