Select Customer-Name, Borrower - Loan-Number As Loan-Id, Amount From Borrower, Loan Where Borrower - Loan-Number Loan - Loan-Number

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 1

FOREIGN KEY: A foreign key is a field in a relational table that matches the primary key column of another table.

The foreign key can be used to cross-reference tables. AS: SQL provides a mechanism for renaming both relations and attributes, it uses the AS clause for rename. The as clause can appear in both the select and from clauses. Example: old-name as new-name select customer-name, borrower.loan-number as loan-id, amount from borrower, loan where borrower.loan-number = loan.loan-number Like: The LIKE operator is used to search for a specified pattern in a column. LIKE is used in the WHERE clause. The most commonly used operation on strings is pattern matching using the operator like. We describe patterns by using two special characters: 1. Percent (%): The % character matches any substring. 2. Underscore ( _ ): The _ character matches any character. SELECT "column_name" FROM "table_name" WHERE "column_name" LIKE {PATTERN}
11.3 MULTIVALUED DEPENDENCIES Multivalued dependencies are a consequence of first normal form (lNF), which disallows an attribute in a tuple to have a set of values. If we have two or more multivalued independent attributes in the same relation schema, we get into a problem of having to repeat every value of one of the attributes with every value of the other attribute to keep the relation state consistent and to maintain the independence among the attributes involved. This constraint is specified by a multivalued dependency. For example, consider the relation EMP shown in Figure ll.4a. A tuple in this EMP relation represents the fact that an employee whose name is ENAME works on the project whose name is PNAME and has a dependent whose name is DNAME. An employee may work on several projects and may have several dependents, and the employee's projects and dependents are independent of one another. To keep the relation state consistent, we must have a separate tuple to represent every combination of an employee's dependent and an employee's project. This constraint is specified as a multivalued dependency on the EMP relation. Informally, whenever two independent l:N relationships A:B and A:C are mixed in the same relation, an MVD may arise.

You might also like