UVM Logo

The
University
of
Vermont



SQL Sub-queries



An advanced tool is the sub-query. It can do MANY things.

Thing 1. Find all the records like this, exclude those that have that.

"How many applicants are Vermont residents whose combined SATs are greater than 1200 but don't have the VS1 attribute?"

SELECT spriden_id, spriden_last_name, spriden_first_name

FROM saturn.spriden, saturn.saradap, saturn.swv_repgen_comb_sats

WHERE spriden_pidm = saradap_pidm

and spriden_pidm = comb_pidm

and saradap_term_code_entry = '199709'

and saradap_resd_code = 'I'

and comb_sats > '1200'

AND NOT EXISTS

(SELECT * FROM saturn.saradap

WHERE saradap_pidm = spriden_pidm

and saraatt_term_code = saradap_term_code_entry

and saraatt_appl_no = saradap_appl_no

and saraatt_atts_code = 'VS1')

 

NOTES: swv_repgen_comb_sats is a locally developed view that "finds" the most recent test scores and combines them for you. See VIEWS.

 

 

Copyright 1995 University of Vermont and others. All rights reserved.

Brought to you through the courtesy of Computing and Information Technology, University of Vermont. Copyright © 1996 The University of Vermont and others. All rights reserved.

The University supports both institutional and personal web pages. The views expressed on personal web pages are strictly those of the author, and are not reviewed or approved by the University of Vermont

Read the Webmaster's Policies.

Send questions and comments to webmaster@uvm.edu

Last page update: March 21, 1997