Select Operation Example Relation r A B C X a 1 7 a B 5 7 B B 12 3 B B 23 10 ■OA=BAD>5(C) A B C D C C 1 7 B B 23 10 Database System Concepts-5th Edition,Oct 5,2006 2.17 ©Silberschat乜,Korth and Sudarshan
Database System Concepts - 5 2.17 ©Silberschatz, Korth and Sudarshan th Edition, Oct 5, 2006 Select Operation – Example Relation r A B C D 1 5 12 23 7 7 3 10 A=B ^ D > 5 (r) A B C D 1 23 7 10
Select Operation Notation:p(r) p is called the selection predicate Defined as: o()={t|t∈rand p(奶 Where p is a formula in propositional calculus consisting of terms connected by A(and),v(or),(not) Each term is one of: <attribute> op <attribute>or <constant> where op is one of:=,≠,>,≥.<.≤ Example of selection: branch_name="Perryridge(accounf) Database System Concepts-5th Edition,Oct 5,2006 2.18 ©Silberschat乜,Korth and Sudarshan
Database System Concepts - 5 2.18 ©Silberschatz, Korth and Sudarshan th Edition, Oct 5, 2006 Select Operation Notation: p (r) p is called the selection predicate Defined as: p (r) = {t | t r and p(t)} Where p is a formula in propositional calculus consisting of terms connected by : (and), (or), (not) Each term is one of: <attribute> op <attribute> or <constant> where op is one of: =, , >, . <. Example of selection: branch_name=“Perryridge”(account)
Project Operation Example Relation r. A B C x 10 1 a 20 B 30 1 B 40 2 (r) A C A C a 1 1 a 1 = B 1 B 1 B 2 B 2 Database System Concepts-5th Edition,Oct 5,2006 2.19 ©Silberschat乜,Korth and Sudarshan
Database System Concepts - 5 2.19 ©Silberschatz, Korth and Sudarshan th Edition, Oct 5, 2006 Project Operation – Example Relation r: A B C 10 20 30 40 1 1 1 2 A C 1 1 1 2 = A C 1 1 2 A,C (r)
Project Operation Notation: ΠA2A(T) where A1,A2 are attribute names and ris a relation name. The result is defined as the relation of k columns obtained by erasing the columns that are not listed Duplicate rows removed from result,since relations are sets Example:To eliminate the branch name attribute of account laccount_number,balance(account) Database System Concepts-5th Edition,Oct 5,2006 2.20 ©Silberschat乜,Korth and Sudarshan
Database System Concepts - 5 2.20 ©Silberschatz, Korth and Sudarshan th Edition, Oct 5, 2006 Project Operation Notation: where A1 , A2 are attribute names and r is a relation name. The result is defined as the relation of k columns obtained by erasing the columns that are not listed Duplicate rows removed from result, since relations are sets Example: To eliminate the branch_name attribute of account account_number, balance (account) ( ) , , , 1 2 r A A Ak
Union Operation Example Relations r,s. A B A B 1 C 2 C 2 B 3 B 1 A B rs: C 1 C 2 1 B 3 Database System Concepts-5th Edition,Oct 5,2006 2.21 ©Silberschat乜,Korth and Sudarshan
Database System Concepts - 5 2.21 ©Silberschatz, Korth and Sudarshan th Edition, Oct 5, 2006 Union Operation – Example Relations r, s: r s: A B 1 2 1 A B 2 3 r s A B 1 2 1 3