数据库代写 | SQL: Queries, Programming, Triggers
本次美国代写主要为SQL相关的assignment
Conceptual Evaluation Strategy
 Semantics of an SQL query defined in terms of the
 following conceptual evaluation strategy:
 Compute the cross-product of relation-list.
 Discard resulting tuples if they fail qualifications.
 Delete attributes that are not in target-list.
 If DISTINCT is specified, eliminate duplicate rows.
 This strategy is probably the least efficient way to
 compute a query! An optimizer will find more
 efficient strategies to compute the same answers.
atabase Management Systems 3ed, R. Ramakrishnan and J. Gehrke
 A Note on Range Variables
 Really needed only if the same relation
 appears twice in the FROM clause. The
 previous query can also be written as:
 SELECT S.sname
 FROM Sailors S, Reserves R
 WHERE S.sid=R.sid AND bid=103
 SELECT sname
 FROM Sailors, Reserves
 WHERE Sailors.sid=Reserves.sid
 AND bid=103
Find sailors who’ve reserved at least one boat
 Would adding DISTINCT to this query make a
 difference?
 What is the effect of replacing S.sid by S.sname in
 the SELECT clause? Would adding DISTINCT to
 this variant of the query make a difference?
 SELECT S.sid
 FROM Sailors S, Reserves R
 WHERE S.sid=R.sidExpressions and Strings
 Illustrates use of arithmetic expressions and string
 pattern matching: Find triples (of ages of sailors and
 two fields defined by expressions) for sailors whose names
 begin and end with B and contain at least three characters.
 AS and = are two ways to name fields in result.
 LIKE is used for string matching. `_’ stands for any
 one character and `%’ stands for 0 or more arbitrary
 characters.
 SELECT S.age, age1=S.age-5, 2*S.age AS age2
 FROM Sailors S
 WHERE S.sname LIKE ‘B_%B’
CONTACT
 
                         
