LAB 1:  Connecting to Oracle using SQL*Plus

  1. Connect to Oracle and change your password.  Refer to the instructions in:        elearning.algonquincollege.com/coursemat/dat2355d/using-sqlplus.html

  2.  
  3. The SQL*Plus command DESCRIBE can be used to list the column names and data types of all columns in a particular table.  Enter the following command to see what columns are in the COURSE table:
  4.     describe course
     

  5. To retrieve data from a table, the SQL select command is used.  Enter the following command to retrieve the data in the COURSE table.  Note that SQL commands must be terminated with a semi-colon (;).
  6.     select * from course;
     

  7. Enter the following command to list only the course number and maximum enrollment columns:
  8.     select courseno, max_enrol from course;
     

  9. The tables in the SQL data dictionary contain information on all objects in the database.  The table USER_OBJECTS contains information on all objects you own in the database.  Enter the following command to list the columns in the USER_OBJECTS table:
  10.     describe user_objects
     

  11. Enter the following command to list details about objects you own:
  12.     select object_name, object_type from user_objects;

    Note that the COURSE table is not listed.  Why?
     

  13. SQL and SQL*Plus commands can be executed from a script file.  A script file is executed using either of the following methods:
  14.     start file-name
        @file-name

    The file-name must include the path. Copy the script file:  create-stock.sql to your A: drive or your N: drive.
    This script file creates a small table called STOCK and inserts some data into it.  Run the file using either start or @.
     

  15. Use the DESCRIBE command to see what columns are in the STOCK table.

  16.  
  17. List the data in the STOCK table.

  18.  
  19. Enter the same command as specified in step 6.  Why is the output different?

  20.  
  21. Enter the command quit or exit to exit from SQL*Plus.