Writing Basic SQL Statements
  1. List the capabilities of SQL SELECT statements
  2. Execute a basic SELECT statement
  3. Describe the use and benefitsof PL/SQL
  4. Differentiate between SQL statements and SQL*Plus commands
List the capabilities of SQL SELECT statements.
  SQL statements are very useful and versatile. We can use
  very simple sql statements to frame very simple queries to very
  complex one.

  The efficiency of a database depends on not how many server's or
  how good a hardware it is running on but on the developer's and
  the people accessing the database.

  A efficient coding style should be followed by all the developers.

  A simple sql statement would be of the form:
  select sysdate from dual;
  This is a simple statement which gets the sysdate from the database.

  A little more complex query would be :
 
 select empno from emp group by empno having count(*) > 1 ;
 
  The above query groups the emp table based on the empno
  then we place a filtering condition on the table by the
  having clause to select only those rows which have more than
  one empno.

  A little more complex sql statement would be:
 
 select dept.deptno, deptname from emp , dept
 where emp.deptno=dept.deptno(+) ;
 
  The (+) here is called a outer join.
  The functionality of a outer join is to supply NULL for that
  column value which did not have a corresponding value in the table
  dept.
  Don't worry we will be covering all of these in the coming days.

  sql can also be used to execute many a functions such as :
  chr,ascii, substr, ltrim, rtrim and many more which will
  be covered in detail.
Execute a basic SELECT statement.
  Here is the basic select statement from above:
 
 select empno from emp group by empno having count(*) > 1 ;
 

Describe the use and benefitsof PL/SQL.
  One Line : It is very useful.

Differentiate between SQL statements and SQL*Plus commands.
  Basically sql statements fall under 3 categories:
  1.)DML ==> Data Manipulation language such as select, delete, Insert.
  2.)TCL ==> Transaction control language such as rollback, commit.
  3.)DDL ==> Data Defining language statements.

  SQL*PLUS
  commands however are executed with in the sql*plus environment
  most of the sql*plus commands have more or less to do with the buffer
  the file which oracle uses as a scratch pad.

  
Caution:In a sql*plus environment if we issue a statement DEL 1 is this a sql*plus command or statement ? A del is used by sql*plus statement to manage the buffer( afiedt.buf) if you specify a del 1 it will delete the current sql*plus buffer line however if you give a delete command then oracle will try to delete a table value by default.
Hosted by www.Geocities.ws

1