Write an SQL statement to create a new table program with th
Solution
(a)CREATE TABLE program
(
program_code varchar2(255),
program_name varchar2(255),
degree_type varchar2(255)
);
INSERT INTO program (program_code, program_name,degree_type)
VALUES (\'P001\', \'Business Information\',\'BSc\');
INSERT INTO program (program_code, program_name,degree_type)
VALUES (\'P002\', \'Comparative Literature\',\'BA\');
INSERT INTO program (program_code, program_name,degree_type)
VALUES (\'P003\', \'Electronic Commerce\',\'BSc\');
INSERT INTO program (program_code, program_name,degree_type)
VALUES (\'P004\', \'Finance\',\'BCom\');
(b)ALTER TABLE student
ADD program_code varchar2(45);
(d)write an sql to show all staff(staff_name,hour_salary) whose hour_salary is higher than the staff May
select staffname,hour_salary from staff where hour_salary>(select hour_salary from staff where staffname=\'May\');
(e)select studentid,module_code from students where exam_score=NULL;
(f)select studentid,module_code,name,module_name,credits from students where credits>30;
(g)select studentid,module_code,name,teachname from students where teachname=\'May\';
(h)select studentid,module_code,averageassign_scores,averageexam_scores from students where averageassign_score>AVG(exam_scores);
(i)select staffid,name,hour_salary * extra_hour extra_pay from staff where extra_pay>9000;