ALTER TABLE Employee ADD ( Mname VARCHAR2(20), Birthday DATE );

Similar documents
An Example file... log.txt

LA PRISE DE CALAIS. çoys, çoys, har - dis. çoys, dis. tons, mantz, tons, Gas. c est. à ce. C est à ce. coup, c est à ce

Optimal Control of PDEs

Framework for functional tree simulation applied to 'golden delicious' apple trees


" #$ P UTS W U X [ZY \ Z _ `a \ dfe ih j mlk n p q sr t u s q e ps s t x q s y i_z { U U z W } y ~ y x t i e l US T { d ƒ ƒ ƒ j s q e uˆ ps i ˆ p q y

The University of Bath School of Management is one of the oldest established management schools in Britain. It enjoys an international reputation for

An Introduction to Optimal Control Applied to Disease Models

Vectors. Teaching Learning Point. Ç, where OP. l m n

Max. Input Power (W) Input Current (Arms) Dimming. Enclosure

General Neoclassical Closure Theory: Diagonalizing the Drift Kinetic Operator

$%! & (, -3 / 0 4, 5 6/ 6 +7, 6 8 9/ 5 :/ 5 A BDC EF G H I EJ KL N G H I. ] ^ _ ` _ ^ a b=c o e f p a q i h f i a j k e i l _ ^ m=c n ^

Examination paper for TFY4240 Electromagnetic theory

Constructive Decision Theory

OC330C. Wiring Diagram. Recommended PKH- P35 / P50 GALH PKA- RP35 / RP50. Remarks (Drawing No.) No. Parts No. Parts Name Specifications

Complex Analysis. PH 503 Course TM. Charudatt Kadolkar Indian Institute of Technology, Guwahati

Planning for Reactive Behaviors in Hide and Seek

Building Products Ltd. G Jf. CIN No. L26922KA199SPLC018990

Computer Systems Organization. Plan for Today

Principal Secretary to Government Haryana, Town & Country Planning Department, Haryana, Chandigarh.

4.3 Laplace Transform in Linear System Analysis

Relation Between the Growth Twin and the Morphology of a Czochralski Silicon Single Crystal

Matrices and Determinants


A Study on the Analysis of Measurement Errors of Specific Gravity Meter

Vector analysis. 1 Scalars and vectors. Fields. Coordinate systems 1. 2 The operator The gradient, divergence, curl, and Laplacian...

A Beamforming Method for Blind Calibration of Time-Interleaved A/D Converters

Loop parallelization using compiler analysis

Front-end. Organization of a Modern Compiler. Middle1. Middle2. Back-end. converted to control flow) Representation

A Study on Dental Health Awareness of High School Students

Symbols and dingbats. A 41 Α a 61 α À K cb ➋ à esc. Á g e7 á esc. Â e e5 â. Ã L cc ➌ ã esc ~ Ä esc : ä esc : Å esc * å esc *

Obtain from theory/experiment a value for the absorbtion cross-section. Calculate the number of atoms/ions/molecules giving rise to the line.

QUESTIONS ON QUARKONIUM PRODUCTION IN NUCLEAR COLLISIONS

ETIKA V PROFESII PSYCHOLÓGA

Redoing the Foundations of Decision Theory

By the end of this set of exercises, you should be able to. reduce an algebraic fraction to its simplest form

TELEMATICS LINK LEADS

MARKET AREA UPDATE Report as of: 1Q 2Q 3Q 4Q

New method for solving nonlinear sum of ratios problem based on simplicial bisection

Plasma diagnostics and abundance determinations for planetary nebulae current status. Xiaowei Liu Department of Astronomy, Peking University

1. Allstate Group Critical Illness Claim Form: When filing Critical Illness claim, please be sure to include the following:

Pharmacological and genomic profiling identifies NF-κB targeted treatment strategies for mantle cell lymphoma

Research of Application the Virtual Reality Technology in Chemistry Education

SOLAR MORTEC INDUSTRIES.

Optimization of a parallel 3d-FFT with non-blocking collective operations

Connection equations with stream variables are generated in a model when using the # $ % () operator or the & ' %

A Functional Quantum Programming Language

Damping Ring Requirements for 3 TeV CLIC

SCOTT PLUMMER ASHTON ANTONETTI

F O R SOCI AL WORK RESE ARCH

UNIQUE FJORDS AND THE ROYAL CAPITALS UNIQUE FJORDS & THE NORTH CAPE & UNIQUE NORTHERN CAPITALS


Stochastic invariances and Lamperti transformations for Stochastic Processes

Sample Exam 1: Chapters 1, 2, and 3

Queues, Stack Modules, and Abstract Data Types. CS2023 Winter 2004

Books. Book Collection Editor. Editor. Name Name Company. Title "SA" A tree pattern. A database instance

Java Applets / Flash Java Applet vs. Flash

First-principles calculations of insulators in a. finite electric field

February 17, 2015 REQUEST FOR PROPOSALS. For Columbus Metropolitan Library. Issued by: Purchasing Division 96 S. Grant Ave. Columbus, OH 43215

New BaBar Results on Rare Leptonic B Decays

h : sh +i F J a n W i m +i F D eh, 1 ; 5 i A cl m i n i sh» si N «q a : 1? ek ser P t r \. e a & im a n alaa p ( M Scanned by CamScanner

( ) Chapter 6 ( ) ( ) ( ) ( ) Exercise Set The greatest common factor is x + 3.

Harlean. User s Guide

Continuing Education and Workforce Training Course Schedule Winter / Spring 2010

PART IV LIVESTOCK, POULTRY AND FISH PRODUCTION

THE ANALYSIS OF THE CONVECTIVE-CONDUCTIVE HEAT TRANSFER IN THE BUILDING CONSTRUCTIONS. Zbynek Svoboda

!!"# $% &" ( )

Port Vintage. Foundry: Onrepeat Types Website: Designer: João Oliveira INTRO PORT VINTAGE REGULAR

U ight. User s Guide

Testing SUSY Dark Matter

Winsome Winsome W Wins e ins e WUin ser some s Guide

Relational Algebra & Calculus

DISSIPATIVE SYSTEMS. Lectures by. Jan C. Willems. K.U. Leuven

Towards a numerical solution of the "1/2 vs. 3/2" puzzle

w = baa tš, w L µ? q 0 K : δ(q 2, b) = q 2 (1)

Advanced Treatment of Sewage Using a Magnetic Fluid Separation

0# E % D 0 D - C AB

This document has been prepared by Sunder Kidambi with the blessings of

Cairns Hospital: Suspected Acute Coronary Syndrome Pathways. DO NOT USE if a non cardiac cause for the chest pain can be diagnosed

AN IDENTIFICATION ALGORITHM FOR ARMAX SYSTEMS

. ffflffluary 7, 1855.

R for beginners. 2 The few things to know before st. 8 Index 31

ADVANCES IN MATHEMATICS(CHINA)

Algorithm for Solving Multi Objective Linear Fractional Programming Problem with Fuzzy Rough Coefficients

B œ c " " ã B œ c 8 8. such that substituting these values for the B 3 's will make all the equations true

Estimation of Retention Factors of Nucleotides by Buffer Concentrations in RP-HPLC

1. CALL TO ORDER 2. ROLL CALL 3. PLEDGE OF ALLEGIANCE 4. ORAL COMMUNICATIONS (NON-ACTION ITEM) 5. APPROVAL OF AGENDA 6. EWA SEJPA INTEGRATION PROPOSAL

The Effect of Deposition Parameter on Electrical Resistivity of TiAlN Thin Film

Ed S MArket. NarROW } ] T O P [ { U S E R S G U I D E. urrrrrrrrrrrv

The Study of 3 rd Overtone Crystal Oscillator

: œ Ö: =? À =ß> real numbers. œ the previous plane with each point translated by : Ðfor example,! is translated to :)

Optimizing Stresses for Testing DRAM Cell Defects Using Electrical Simulation

SECTION A - EMPLOYEE DETAILS Termination date Employee number Contract/ Department SECTION C - STANDARD DOCUMENTS REQUIRED FOR ALL TERMINATIONS

2016 xó ADVANCES IN MATHEMATICS(CHINA) xxx., 2016

For example, to get ~, type Option-Shift-0 for Mac and Alt- Shift-0 for Windows. H J K. m M. n N. (Alt) thinspace 255

The evaluation of P, and T from these formulae indeed requires that the energy E be expressed as a function of the quantities N, V and S.

Winstar Display Co., LTD

Juan Juan Salon. EH National Bank. Sandwich Shop Nail Design. OSKA Beverly. Chase Bank. Marina Rinaldi. Orogold. Mariposa.

Synchronizing Automata Preserving a Chain of Partial Orders

Unit 3. Digital encoding

Transcription:

!! "# $ % & '( ) # * +, - # $ "# $ % & '( ) # *.! / 0 "# "1 "& # 2 3 & 4 4 "# $ % & '( ) # *!! "# $ % & # * 1 3 - "# 1 * #! ) & 3 / 5 6 7 8 9 ALTER ; <= >? @ A B C D E <> F G H I A = @ A J > K L ; <= >? @ A B C D E <> F G H I A = @ A J > F L M N O O P Q R S T U VW X Q Y ALTER TABLE Employee ADD ( Mname VARCHAR2(20), Birthday DATE ); Z [ S Q R P Q R T U VW X Q \ ] ^ _ ` a `b `c a d ALTER TABLE Emplyee Modify ( Mname VARCHAR2(10) ); Cannot be NOT NULL unless the table is empty : f g h i j j kl m n i op q l r s ALTER TABLEEmployee DROP COLUMN Mname; g h i j j kl m q p ot kj ou n i op q l r s ALTER TABLE Employee DROP (Mname, Birthday); f v w w kl m n i l r t h x kl t r s ALTER TABLEDepartment ADD( FOREIGN KEY (ManagerId) REFERENCES Employee(SSN)); e z F >? {F C D E <> @F = f } ~ v q x j h kl t t x ƒ ou r t x t i ow r i q u m u l u h x o kl i h q x t ki l x ƒ i p t t u t x ƒ ou r kl i p h w x t x ƒ x r u f p n x ƒ ou r x h u s ˆ Š Œ Š Ž Œ Š t i i w u t x k ou w f i r u u t u okr t i x oo i p h t x ƒ ou r i p n x l j h kl t s ˆ š œ ž Ÿ Š Ž ˆ š Ž Š œ ž Ÿ Š ˆ š Ž Š Š Š ª «ª ª y

> Describe Employee Name Null? Type -------- -------- ------------ SSN NUMBER FNAME VARCHAR2(20) LNAME VARCHAR2(20) GENDER CHAR(1) SALARY NOT NULL NUMBER(5)! " # $ % & ' ( & ) INSERT INTO Employee(SSN, Fname, Lname, Salary) VALUES(121, Sara, Cohen,10000); * +, -. - / 0 12 12 3 4 5 67 / 2 8 3-9 : - ; 0 7 69 < 0 67-8 = 5. >? @ @ A * B, - 2 C 1 66 9, 18 ; 0 1 6D F G H I H J K L M N OM PQ R S M M Q S TU V M R W M X O N OM Q ON Y Z P[ M R Z \ M R W M X ON OM Q N ] \ Z P P X ] P[ ^ S R Z S Q OS U L M ] \ Q M \ Q M N O S M Q V _ U L M U Z V PM Example: INSERT INTO Employee VALUES(121, Sara, Cohen, `F, 10000); E b & c $ ) DELETE FROMTable WHERE Cond; d & & &! c ' e Cond c $ Table f g $ % & h $ i " $ % & '! " j j k l m l c $ " # $ % & ' ( & ) DELETE FROM Employee WHERE SSN = 121; `a H n o p q z { } ~ ƒ ƒ ~ ˆ Š $ i & & $ & $ % & ' " i e & ' e " l r s s s " t & ) DELETE FROM Employee WHERE Case sensitive Gender = M AND Salary > 15000; " WHEREu & v ( u & &' " $ w v ' `` Œ Ž š œ š š ž Ÿ UPDATE Table SET Field1=value1,,,FieldN=valueN WHERE Cond ª «ª ª ± «² ª ³ UPDATE Employee SET Salary = 15000 WHERE Gender = M AND Salary > 15000; xy

ˆ ƒ } ƒ ~ ƒ š š š ž š œ Ÿ š š š ž Ž œ š ž Ž ž Ž ž š ž ž ž Ž Ÿ Sara Cohen 121 Benny Kimelfeld 134 Yaron Kanza 156 x Ž š š Ž š ž Ž š Ÿ LOAD DATA INFILE <datafile> [APPEND] INTO TABLE <tablename> FIELDS TERMINATED BY '<separator> (<list of all attribute names to load>) x ƒ ~ ƒ ƒ ~ ˆ Š O P Q R S T U V S W X Y WQ Z [ S T U Y T \ Q ] ^ <datafile>:! " # $ % &! %! $ '( <tablename>:! " # $ % %! ) ( ' % # * '+ % &! %! * '(( ) (#! & &,! - - & & '$. / / 0 1 2 '3 3 - + '$ ' & 4 # 5 (3 % %! ) ( " 6 3 % ) " - % 7 8 _ ` a b c d e b f g hd i j k d l m hhm n oc p q m c j r m h l o hd j k d d f g hm t d d a l r m f f t u f g hm t d d a vs b j w LOAD DATA INFILE myemployees.dat INTO TABLE Employees FIELDS TERMINATED BY ' ' (Fname, Lname, SSN) <separator>:. 3 % 5 ' 9 %! % 3 -! 5! % 3 % * # $ ' (& :! (6 3 # $! 5 # * x y z { } ~ z y { { } z ƒ z ~ ~z ~ ˆ ˆ z ; < = >?? @ AB C? = D > @ = D = E > @ >? = F B G H I J J > D > K F = K H LI D = F AK E > @ = K? < = D = D z Š Œ Œ x MN hm b s a O P Q Ž U X Y WQ _ k d h m b s d r q m c a os d r a d d r t a oc p hd hoc d j m r d g r d a d c j m c d r m n oc j k d j b hd u d c b c d f g j t hoc d n k oq k n o hh a b hht r d a hj oc b c d r r m r š _ g b q d a b r d c m j op c m r d s oc j k d s b j b l o hd j k a j k d r m n a a b r b œ q m k d c œ ž b c s a b r b œq m k d c œ ž s d l oc d s ol l d r d c j l c q j om c b hoj od a Ÿ ª«ª ª ± ² ³ µ µ ± ± «± µ ª M O P Q Ž U X Y WQ Z [ S T U Y T \ Q ¹ ^ _ k d q m c j r m h b c s j k d s b j b l o hd a q b c d q m f oc d s oc j m m c d vq j h l o hd a oc p j k d l m hhm n oc p l m r f b j w LOAD DATA INFILE * INTO TABLE Employees FIELDS TERMINATED BY ' ' (Fname, Lname, SSN) BEGINDATA Sara Cohen 121 Benny Kimelfeld 134 Yaron Kanza 156 M

O P Q \ W T S [ U YS T @ A BC D E F G H I J K L E I M F N M O H K F I C P Q Q R S T U V W R sqlldr <yourname> control=<ctlfile> < S S S log=<logfile> bad=<badfile> Q R! "" # $% "& ' ( ) % * +, $* - ( " S. $"% - ( / % ', 0 (, 0 ( 1 % - * % 2, % - ' $* - ( ) % ( 3, * / (, $4 ( ""5 % 2, % - & % & 6 7 5 8& (, 9 8"* : * ) 87 ( & ; < Q Q R badfile X T Y Z R [ R Y Y < Y Y \ T X Y V U < T [ X ] < logfile= M >? h i j k l m n o p n q j q r s ` a b a c d e fd g ^ _ t u v w x y z { } { ~ } } x ~ ƒƒ~ } { ƒ w x ˆ Š Œ Ž Ž Ž š Ž œ Ž t } ƒz x ƒx { } ž y ~ Ÿ y x y x v w y x ž t y ž x y ~ { ƒ w x ƒ z ~ x >> ª «ª ª «ª SELECT [Distinct] Attributes FROM relations WHERE condition; ± ² ² ³ µ ² ¹ º Ššˆ Œ š Šœ ˆ Œ š Œ» Ž Ž ¼ Œ ˆ ½ ¾ Ž Š À Á šœ  Á Ã Ä ³ ÅÆ ² Ç È ¹ º Ššˆ Œ Ž Š Œ š ˆ ½ ¾ Ž Š À Á Š ˆ Â É Ž Œ Œ ˆ Â Ê Ž Ë ˆ Ã Ä Ì Ç È Í ² Ç È ¹ º Î Š œ šœ š ½ ¾ Ž Š À Á šœ Ï Ð Ñ Â Ž Á Ò ÓÔ ŠÕ Ã Ö Ø Ù Ú Û Ù ¹ Ü Œ š Š Ë Ž œ Œ œ Š Œ œ Šš Œ ˆ SELECT [Distinct] attributes FROM relations WHERE condition; t Þ ß à áâ ã ä å x æ ç è é è ê å æ { ƒ w x ž x } x x ~ ë x y ~ } ~ ì í ß î ã â à áß ï y ~ Ÿ x y x ƒ ~ } ƒ Ÿ ~ ž x ƒ ð ç x ƒx { ~ } ž x } x ž z x ñ ò è ó è { ƒ w x ð Ý

ª «ª 1 2 3 45 6 7 8 7 9 : ; < SELECT [Distinct] attributes FROM relations WHERE condition; è ƒw ~ } ~ y ž x y SELECT Distinct A 1,,A n FROM R 1,,R m WHERE C; Ñ Ä Œ Œ Ž ˆ ˆ Ž œ Œ Œ Œ Š ˆ š = A1,,A! " # $ $ % & n (> C (R 1 x x R m )) ' ( ) *+, *-., $! # " $! /0 7 9 : ; < @ 4A B C 9 A @ D E F E 7 9 : ; < @ 4A B C 9 A H ; C I : 5 A 4C J SELECT Distinct A 1,,A n FROM R 1,,R m SELECT Distinct * FROM R 1,,R m WHERE C; = A1,,A n (R 1 x x R m ) (> C (R 1 x x R m )) /? / G 7 9 : ; < @ 4A B C 9 A H ; C I : 5 A 4C J L @ 4A B C 9 A @ D E F E E O 2 P Q R: S 2 T R: 3 U 3 : V SELECT Distinct * FROM R 1,,R m R 1 x x R m /K Y ^ _ b # d " c a " ` ` _ W " Y Z d ' ^ Z ^ ^ ^ ^ Z ` Y Z Y Y Z ^ _ e ` #! f! g d W X ` Y Z Y Y Z [ Y Z [ \ ] Y Z Y Y[ Y [ \ ] MN

SELECT DISTINCT sname, age FROM Sailors WHERE rating>7;! " # $ % $! & ' ( $ #! ) $ * +, -. /0-1 / 2 3 4 5 6 78 9 : ; < = >? @ A B C D D E F G H I J K L MN O G H P H Q L MO R H N ST T H P H I O ST J H P H U K V H N N SQ O SI W O X [ \ ] ^ _ `a` a b c a d e SELECT DISTINCT sname FROM Sailors, Reserves WHERE Sailors.sid = Reserves.sid and bid = 103; Q: What does this compute? A: names of sailors who reserved boat 103 Q: Write it in relational algebra f (g (Sailors x Reserves)) sname Sailors.sid = Reserves.sid h bid = 103 YZ l q o p q rs m l l p ˆ k m p ~ q } l ~ q } l ~ q } k m } k m j } l ~ t u j } l ~ t u Sailors x Reserves p k ƒ { u ƒ { u { { { { { { z { u z { u l q j k l k m n k l q p ii l q Sailors.sid = Reserves.sid h bid = 103 o p q rs m l j k l k m n k l l p ˆ k m p ~ q p k l q q p } l ~ q ƒ { u } l ~ q ƒ { u } k m { { { } k m { { { j } l ~ t u z { u j } l ~ t u z { u iš l q o p q rs m l l p ˆ k m p ~ q } l ~ q } l ~ q } k m } k m j } l ~ t u j } l ~ t u Sailors sname x Reserves p k ƒ { u ƒ { u { { { { { { z { u z { u l q j k l k m n k l q p iœ FROM Sailors S, Reserves R WHERE S.sid = R.sid and R.bid = 103; š œ ž Ÿ œ œ Ÿ œ Ÿ ž Ÿ ª š «Ÿ œ Ÿ ± ² ³ µ ¹ º» ¼ ½º ¾ º À À º ¼ ¹ Á Â Ã Ä Å Æ Â ½º Ç ¹ È É» ½º ¼ ¾ Ä º» Ê Ä ½º ¾ º ½ Ë ½Ê Ì ¼ º iž

! " #$# $ % & FROM Sailors S, Reserves R WHERE S.sid = R.sid and R.bid!= 103; º ¾ ¹ ¹ ¼ Ç ¼ Ë º» ¹ ¾ µ ¹ º ½¾ ¼ ¹ Á ¾ ¼ ¹ ¼ º Ì ¾ º ¾ ¼ º Ì ¾ º ¾  ¹ º ½¾ ¼ ¹ Á ¾ ¼ ¹ ¼ Ì ¾ Ì ¾ º º º µ µ ¼ Ì ¾ º Á ½ ½ º À À º ¼ ' ( ) *) +, - * * +. */ 0 1 2 3 4 5 6 5 7 8 9 : ; < = 4 >? @A B C 4 D ' E ) 1-0 ) 2 ) *) +, ) F +. */ 0 1 2 3 4 5 6 5 7 8 4 GC H > I J K 4 4 >? @A B C L M > I J : ; < = 4 >? @A B C 4 D ' N O O *P Q 1 R S / 1 +, Q. 1 2 T ) UR U V W -, X ) 0 -, Q+ - * 0-1 QO / *-, Q. 1 2 Y 4 5 6 5 7 8 Z > [ J \ ] ^ 9 _ : ; < = 4 >? @A B C 4 D a b c d & ª «È Ç» ¼  º ½ ± e ¹ ¼ Ê Â ¾» À º ¼ ¹ ¾ fg hi j hg h i h j h j g h i g h k l m n l l o p q r s t r r u vw xy z { vw x} ~ ƒ ˆ Š Œ Ž h Š ƒ ƒ ƒ š h œ š ž Š Ÿ ƒ ƒ Œ ƒœ ƒ ž h œ ± o ² ³ l µ ² ¹º» ± ¼ ½ µ ² ¾ l j g À Ž» ² m o ¾ œ š Á ±  h ± o ² ³ l µ ± ² ¹º» ± ¼ ½ µ ±  p Ã Ä Ä Å h Ä Å Å h Å Å ~ º» ± o ² ³ l k l m n l l o p ÆÇ l º» ¾ l È ² o  ÆÉ ² Ê ¹È~ Á ` Ì Í ª Î Ï Ð Ñ ª Ò Ó Ô Ò ã ä Î å æ ª Ò ç Õ ˆ Š ž ƒ ˆ Š Ö Œ ƒ Š Ø Ù ˆ Š Ú Û Ü ² ³ Ý ¹l Þ SELECT S.sid FROM Sailors S, Reserves R WHERE S.sid = R.sid; SELECT sid FROM Sailors WHERE sname LIKE R_%y ; ß ƒœ Œ ƒ Š ž Š à ƒœ á Š ž Š Œ When would adding DISTINCT give a different result? Ë â

Ò ª ç Ô Ó Í ª «ª Ó Í ª «ª SELECT S.sid FROM Sailors S, Reserves R WHERE S.sid = R.sid; SELECT DISTINCT R.sid FROM Sailors S, Reserves R WHERE S.sid = R.sid; SELECT R.sid FROM Reserves R ª ä æ ª Ò ç FROM Sailors S, Reserves R1, Reserves R2. WHERE S.sid = R1.sid and R1.sid=R2.sid and R1.bid!=R2.bid;! " # FROM Sailors S, Reserves R, Boats B WHERE S.sid = R.sid and R.bid = B.bid and B.color = 'red' $ % & ' ( ) * +, - ) '. - /, ) 0 / 1 2 3 % 4 ( 5, - + 6 - (. 7+ / - 8 ' + ' ( 9, /, -, / 9, * ( /, * : + ( ) ;! " # $ % = + 8 8 + 0 7* > + 0? 0, / > ) ', @ + 7+ / - + 6 : + ( ) - /, -, / 9, * : > A + : 2 3 % SELECT distinct B.color FROM Sailors S, Reserves R, Boats B WHERE S.sname = Bob and S.sid = R.sid and R.bid = B.bid < C " D! " C E F G! H! I JF K L ', M N O P N A Q @ 7( 0 -, @ ( 1 :, 0 -, * ) + - + / ) /, - 0 7) - : > + 1, + / 5 + /, @ + 70 5 1 - K L ', *, 6 ( 0 7) - + / ). 1 R. -. 1 ( - @, 1 *. 1 R + / *, / K S ( 1 - T, @.6 > 3 U S + / O P U S W X Y Z [ J! J! SELECT sname, rating, age FROM Sailors S WHERE age > 50 ORDER BY rating ASC, age DESC B V

C F G! " H! JY F Y J J! " Y C [! " Y F " I K U + 6 ( / 8, ' ( 9, -,, 1 -, 7, @ ). + 1 T / +, @ ). + 1 ( 1 * S ( / ), -.( 1 T / + * 0 @ ) K = + 8 * + 8, * + + T, / ( ) + / - 4 M 4 ( 1 * 4 U 2 G "!! W C [! " Y F " I K $ 0, / > 4 M 4 $ 0, / > K $ 0, / > 4 U $ 0, / > K $ 0, / > 4 L P N U P S L $ P N Q K 4 + ), % L ', + T, / ( ) + / - /, 5 + 9, * 0 T 7.@ ( ), - : > *, 6 ( 0 7) K = + 8 8 + 0 7* > + 0, T /, - -. 1 ), / -, @ ). 1 N, 7( ).+ 1 ( 7 3 7R, : / ( 2 G Y F D! I F G I I "! F " SELECT DISTINCT S.sname FROM Sailors S, Reserves R, Boats B WHERE S.sid = R.sid and R.bid = B.bid and (B.color = 'red' or B.color='green')! "# $ % & ' ( ) * +, - Y J " I / G 01! "! I! " 1! D "! D 2 3 4 5 6 6 7 8 9 : ; FROM Sailors S, Boats B, Reserves R WHERE S.sid = R.sid and R.bid = B.bid and B.color = red < = >?@ A B C D E F D G C H I JI K LM I > N UNION N O L?= J N P H = JI N I JM I @ Q = R H JI @ O S @ K JI I S Q = O R N T FROM Sailors S, Boats B, Reserves R WHERE S.sid = R.sid and R.bid = B.bid and B.color = green ;. W : X Y9 5 Z [ \ 9 ]^ 6 5 6 Z 6 5 ^ 6 _ 5 6 _ ` a b 4 5 6 6 7 8 9 : ; Z FROM Sailors S, Reserves R1, Reserves R2 Boats B1,Boats B2, WHERE S.sid = R1.sid and R1.bid = B1.bid and B1.color = red and S.sid = R2.sid and R2.bid = B2.bid and B2.color = green ; UV d e Y; XZ 6 ; f g : 4 h i j 6 5 : ; 9 5 Z k l m n o p q r s q t s ur v wx s y o z { q } ~ y t q p } t o ƒ ƒ ˆ Š ˆ Œ ƒ Š k t q v wy o x ~ ~ } t p o } r wž n n } y o r } p t y } y s x ~ wuv q p y o y r ~ y t } t ur Uc

: j Y6 SELECT FROM UNION ALL SELECT FROM DISTINCT sname Sailors S DISTINCT sname Sailors S UU! " # " $ " % & ' ( ) ( * +, -. $ / 0 1 2 3 4 % # 3 5, " # " % 6 " #, 7 8 ( 0 ( # $ 9 : # " " ; # $ < % 4 = 3 >? " % " #! = " 9 @A " 4 % B " CD E F? "! > 4 $? # > 4 % G H F? "! > 4 $! C H J K L M K N O PN Q R PS T U K VS PW VN O N Q K VS Q X FROM Sailors S WHERE S.sid IN (SELECT R.sid FROM Reserves R WHERE R.bid = 103); Y Z [ \ ] ^ _ ] Z ` a^ b ] c d ^ ef \ b \ ] \ b f \ g h ^ Z i j k l m d Z i c ^ n ag d Z o o \ p `_ c \ c b ^ i \ Y q r s Y t I v w x v y x z { ~ x y w x FROM Sailors S WHERE S.sid NOT IN (SELECT R.sid FROM Reserves R WHERE R.bid IN (SELECT B.bid FROM Boats B WHERE B.color='red')) u Sailors who are not the youngest: SELECT * FROM Sailors S1 WHERE S1.age > ANY (SELECT S2.age FROM Sailors S2); We can also use op ALL(op is >, <, =, >=, <=, or <>). }

x w Names of sailors who ve reserved boat 103: SELECT S.sid FROM Sailors S What would happen if we wrote NOT EXISTS? WHERE EXISTS (SELECT * FROM Reserves R WHERE R.bid = 103 and S.sid = R.sid);!" " # $ " $ % & ' ( ) ( * + %, ' ( -. ( %, & ), / 0! ( 1 ),, $! - 2, # 3 4 5 6! 3, 3 7 8 % $ # 9 # $., 2 : ;#! (, 0 # % 2, # $ ;% % : <, 0 #! ( ( # $ ;% % :!3, # 3, # * 4 ' ", 0 #! ( ( # $ ;% % : : $ % * 2 / # 3 ) $ # 3 2 ;, <, 0 # % 2, # $, 2 : ;#!3 ) * * # *, %, 0 # $ # 3 2 ;, 4