Page 76 - DCAP402_DCAO204_DATABASE MANAGEMENT SYSTEM_MANAGING DATABASE
P. 76

Unit 4: Advanced SQL




          The result of the expression is as follows:                                           Notes










          Find all customers who have either an account or a loan (but not both) at the bank

          Select cust_name
          From (depositor natural full outer join borrower)
          Where account_no is null or loan_no is null




              Task       Role of natural join in DBMS.




             Lab Exercise  Create a table with 6 column and enter at least five values in the table and do
             this exercise:
             1.  select top 40% from table
             2.  select column1, column2 and column3 simultaneously from table (joint all)

          4.6 Summary


              SQL also has a good programming level interfaces.
              The SQL supports a library of functions for accessing a database.
              These functions are also called the Application Programming Interface (API) of SQL.
              The advantage of using an API is that it provides flexibility in accessing multiple databases
               in the same program irrespective of DBMS, while the disadvantage is that it requires more
               complex programming.

          4.7 Keywords


          Full Outer Joins: The full outer join type is a combination of the left and right outer-join types.
          Inner Joins: Inner joins return all rows from multiple tables where the join condition is met.
          Natural Joins: Natural join combines two tables based on their common columns i.e. columns
          with the same name.
          Nested Query: A query inside a query is called as nested query.
          Subqueries:  Subqueries are similar to  SELECT chaining.  While  SELECT chaining  combines
          SELECTs on the same level in a query, however, subqueries allow SELECTs to be embedded
          inside other queries.
          Views: A view is a virtual table, which does not actually store data.





                                           LOVELY PROFESSIONAL UNIVERSITY                                   69
   71   72   73   74   75   76   77   78   79   80   81