Queries PractiCe (cese wsis swdent ¢ snum integer not null, firstname varchar(30) not null, year integer not null, create Eab1e prgfes??r ( * The percentage of professors who have p B )) El'aSFflame varchar(30) not null, h hi l A create table course ( office char(6) not null, taug t or teac ng at least two sections cnum charcs) not null . dept char(2) not null, of a single course during the same term. |cname varchar(50) not null, Pprimary key (pnum)); Note that a percentage should be a number [Primary key (Cmtlm)g ;b1 Sion . create table section between 0 and 100, and that you can assume there is cnum char(s) not null, at least one professor. term char(5) not null, section integer not null, pnum integer not null, primary key (cnum,term,section), foreign key (cnum) references course(cnum), foreian key (pnum) references professor(pnum)); COUNT PROFS Fg,,,,,r pnum(PROFESSOR) N, i T"'O_SECTION_PROFS < O count(section)>1 | FCOUNT sectioru(SE('TIO-\')) cmmn,lerm.pnum The two operations in the above step, Aggregate and Select, can be split into two steps. COUNT_TWO_SECTION_PROFS€ Feoynr pnum(TWO_SECTION_PROFS) rm,section)); RESULT COUNT TWO SECTION PROFS/COUNT PROFS * 100
Page1of 1
Uploaded by agaoso on