Posts

Showing posts from July 2, 2017

rename operation with select statement

The rename operation with select statement This is a mechanism used for renaming both relations and attributes, this meaning is highly useful when one has to compare a set of tuples of the same relation with other tuples of the relation. It has the following general format: Old_name as new_name, The as clauses can appear in both the select and from clauses. For example if we want the attribute name loan_no to be replaced with the name loan_id, we can write a query as select distinct cust_name, borrowers.loan-no as loan_no From  borrowers,loan Where borrower.loan_no=loan.loan.no AND Branch_name=”KR CIRCLE” Tuple variables To define tuple variables, we use AS clause, Tuple variables are defined in the from clause via the use of the AS clause. A tuple variable in SQL must be associated with a particular relation. To illustrate we write the, query “For all customers who have a loan from the bank, find their names and loan numbers” as select distinct cust_name, B...