Nội dung text cha 3 Introduction to SQL& Relational Model.pdf
DBMS CHA 3 PAD LE BETAA 1)Explain keys. Super key A super key is a set of one or more attributes that can be identify each tuple uniquely in a relation. Candidate key Candidate key is a super key for which means it is subset is a super key. A candidate key is single attribute or the least combination of attribute that uniquely identifies each record in table. Primary key A Primary key is a candidate key that is chosen by database designer to identify tuples uniquely in a relation. Primary key = not null + unique key. Alternate key An Alternate key is a candidate key that is not chosen by database designer to identify tuples uniquely in a relation. Foreign key A foreign key is a set of one or more attributes whose values are derived from the primary key attribute of another relation. It is a single attribute or collection of attributes in one table. That refers to the primary key of another table. The table containing the primary key is called parent table. & the table containing the foreign key is called child table. 2)What is relational algebra? Explain relational algebraic operation. Relational algebra is a language for expressing relational database queries. Relation algebra is a procedural query language. Relational algebraic operations are as follows: Selection:- Operation: It is used to select particular tuples from a relation. It selects particular tuples but all attribute from a relation. Symbol: σ (Sigma) Notation: σ(condition) Operators: The following operators can be used in a condition. =, ?, <, >, <=,>=, Λ(AND), ∨(OR)