中文网站
  Advanced Search
Read the latest Blogs from IT professionals in the field. Read and write community created documents. Need IT help? Ask our staff. Connect with your peers. Check our Tech Shop for posters, books and software tools. Home

5.1.2 Database Systems: Simple Queries

1. For example, to find all customers having an account at the SFU branch:

deposit bname account# cname balance
  SFU   P._x  
  • A P. before the variable causes printing.
  • A P.ALL. prefix suppresses duplicate elimination.
  • A P. in front of the row prints all attributes.
  • The domain variable may be omitted if it is not used elsewhere.
  • Arithmetic expressions are allowed.
  • Comparison operators are allowed, space on left hand side is left blank.

2. To find the names of all branches not located in Burnaby:

branch bname assets bcity
  P.   ï¿¢Burnaby

3. To find all customers having an account at both the SFU and the MetroTown branch:

deposit bname account# cname balance
 

SFU

MetroTown

 

P._x

_x

 

4. To find all customers having an account at either branch or both:

deposit bname account# cname balance
 

SFU

MetroTown

 

P._x

P._y

 

5. Find all customers having an account at the same branch as Jones:

deposit bname account# cname balance
 

_x

_x

 

Jones

P._y

 

Database System Structure: