select distinct select list selectfrom from list

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CT [DISTINCT] select-list selectFROM from-list fromWHERE qualification; ALTER TABLE Students CHANGE SSN ID CHAR(9); (Changes name of SSN column to ID; possibly also changed type.) ALTER TABLE Students CHANGE ID ID INTEGER; (Changes type of the ID column.) 31 31 32 Query Evaluation Query Examples (Q1) Conceptually: 1. 2. 3. 4. Compute cross-product of tables in from-list. crossfromDelete rows that fail qualification. Delete columns not in select-list. selectIf DISTINCT, delete duplicate rows. Find names of sailors who have reserved boat number 103. SELECT DISTINCT S.sname FROM Sailors S, Reserves R WHERE S.sid=R.sid AND; S.sid=; SELECT DISTINCT sname FROM Sailors, Reserves WHERE Sailors.sid=Reserves.sid AND bid=103; Sailors.sid= 33 Query Examples (continued) (Q1) Query Examples (continued) (Q1) Find the names of sailors who have reserved boat 103. Find the names of sailors who have reserved boat 103. Can be done using EXISTS: Can be done as nested query: SELECT S.sname FROM Sailors S W...
View Full Document

This note was uploaded on 10/15/2012 for the course CSE 4503 taught by Professor Edallen during the Fall '12 term at Mississippi State.

Ask a homework question - tutors are online