SQL Queries

In IS 331 Text - Chapter 10

Tables are available in the IS331 tablespace for practicing the SQL queries in Chapter 10 of Database Processing by David M. Kroenke. Please copy these tables to your tablespace by using the instructions found in SQL Exercise 1.

The following tables are used in the sample queries throughout the chapter.

JUNIOR

HONOR_STUDENT

STUDENT

CLASS

ENROLLMENT

FACULTY

Please note the following differences between the SQL queries printed in Chapter 10 and ORACLE's implementation of SQL.

SQL> select a.name

from student a

where a.gradelevel = 'GR'

and not exists

(select *

from enrollment b

where a.sid = b.studentnumber

and b.classname in

(select c.classname

from enrollment c

where b.classname = c.classname

and c.studentnumber in

(select d.sid

from student d

where c.studentnumber = d.sid

and d.gradelevel != 'GR')));

 

UPDATE enrollment

SET positionnumber = 44

WHERE studentnumber = 400;

SQL> update enrollment

set positionnumber =

(select max(positionnumber) + 1

from enrollment)

where studentnumber = 400;

UPDATE class

SET Name = 'BD564'

WHERE Name = 'BD445';

The following tables may be used with Group 1 Questions at the end of the chapter.

SALESPERSON

SALES_ORDER

CUSTOMER


Return to ORACLE/SQL Tutorial Contents Page