0% found this document useful (0 votes)
225 views7 pages

Practice 1: Introduction To Oracle9i: SQL 1

This document provides instructions for practice exercises using SQL and accessing Oracle database tables. It includes examples of SELECT statements to retrieve data from the EMPLOYEES and DEPARTMENTS tables. The exercises have the user issue commands in iSQL*Plus to view table structures, run queries, and save SQL statements to files.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
225 views7 pages

Practice 1: Introduction To Oracle9i: SQL 1

This document provides instructions for practice exercises using SQL and accessing Oracle database tables. It includes examples of SELECT statements to retrieve data from the EMPLOYEES and DEPARTMENTS tables. The exercises have the user issue commands in iSQL*Plus to view table structures, run queries, and save SQL statements to files.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Practice 1

1. Initiate an iSQL*Plus session using the user ID and password provided by the instructor.
2. iSQL*Plus commands access the
database. True/False
3. The following SELECT statement executes successfully:
SELECT last_name, job_id, salary AS
Sal FROM employees;

True/False
4. The following SELECT statement executes successfully:

SELECT *
FROM job_grades;

True/False
5. There are four coding errors in this statement. Can you identify them?

SELECT employee_id, last_name


sal x 12 ANNUAL SALARY
FROM employees;

Introduction to Oracle9i: SQL 1-1


Practice 1

6. Show the structure of the DEPARTMENTS table. Select all data from the table.

Introduction to Oracle9i: SQL 1-2


Practice 1 (continued)
SELECT *
FROM departments;

7. Show the structure of the EMPLOYEES table. Create a query to display the last name, job code,
hire date, and employee number for each employee, with employee number appearing first. Save
your SQL statement to a file named lab1_7.sql.

SELECT employee_id, last_name, job_id, hire_date


FROM employees;

Introduction to Oracle9i: SQL 1-37


Practice 1 (continued)

8. Run your query in the file lab1_7.sql.

Introduction to Oracle9i: SQL 1-38


Practice 1 (continued)

SELECT employee_id, last_name, job_id, hire_date FROM employees;


9. Create a query to display unique job codes from the EMPLOYEES table.

SELECT DISTINCT job_id FROM


employees;

Introduction to Oracle9i: SQL 1-38


Practice 1 (continued)

If you have time, complete the following exercises:


10. Copy the statement from lab1_7.sql into the iSQL*Plus Edit window. Name the column headings
Emp #, Employee, Job, and Hire Date, respectively. Run your query again.

Introduction to Oracle9i: SQL 1-39


Practice 1 (continued)
11. Display the last name concatenated with the job ID, separated by a comma and space, and name
the column Employee and Title.

If you want an extra challenge, complete the following exercise:


12. Create a query to display all the data from the EMPLOYEES table. Separate each column by
a comma. Name the column THE_OUTPUT.

Introduction to Oracle9i: SQL 1-39

You might also like