-
Connect to Oracle and change your password. Refer to the instructions
in: elearning.algonquincollege.com/coursemat/dat2355d/using-sqlplus.html
-
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:
describe course
-
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 (;).
select * from course;
-
Enter the following command to list only the course number and maximum
enrollment columns:
select courseno, max_enrol from course;
-
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:
describe user_objects
-
Enter the following command to list details about objects you own:
select object_name, object_type from user_objects;
Note that the COURSE table is not listed. Why?
-
SQL and SQL*Plus commands can be executed from a script file. A script
file is executed using either of the following methods:
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 @.
-
Use the DESCRIBE command to see what columns are in the STOCK table.
-
List the data in the STOCK table.
-
Enter the same command as specified in step 6. Why is the output
different?
-
Enter the command quit or exit to exit from SQL*Plus.