0% found this document useful (0 votes)
39 views2 pages

Paghunasnarobertoactivity 1

This document provides instructions for 10 activities using SQL and the Oracle database. The activities include initiating a SQL session; checking for errors in a SQL statement; describing and selecting from tables; creating and running SQL queries; and displaying concatenated columns with a custom heading. Responses to each activity question are provided and formatted in bold as instructed.

Uploaded by

robe paghunasan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views2 pages

Paghunasnarobertoactivity 1

This document provides instructions for 10 activities using SQL and the Oracle database. The activities include initiating a SQL session; checking for errors in a SQL statement; describing and selecting from tables; creating and running SQL queries; and displaying concatenated columns with a custom heading. Responses to each activity question are provided and formatted in bold as instructed.

Uploaded by

robe paghunasan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

ACTIVITY 1 – ACT-2A AIM101

General Instructions: All answers must be in bold format. ACTIVITY 1

1. Initiate a SQL*Plus session using the user ID and password used during the installation.
answer: local
2. SQL*Plus commands access the database. True/False
answer: FALSE
3. Will the SELECT statement execute successfully? True/False
answer: TRUE
4. There are four coding errors in this statement. Can you identify
them?
Errors:
1 The EMP table does not contain a column called salary.
The column is called sal.
2. The multiplication operator is *, not x, as shown in
line 2.
3. The ANNUAL SALARY alias cannot include spaces. The
alias should read
ANNUAL SALARY or be enclosed in double quotation
marks.
4. A comma is missing after the column, ENAME.
5. Show the structure of the DEPT table. Select all data from the DEPT table.
Name Null? Type
------ ------ ------------
DEPTNO NOT NULL NUMBER(2)
DNAME VARCHAR2(14)
LOC VARCHAR2(13)

answer:

SQL> DESCRIBE dept


SQL> SELECT *
2 F ROM de pt ;

6. Show the structure of the EMP table. Create a query to display the name, job, hire date, and
employee number for each employee, with employee number appearing first. Save your SQL
statement to a file named a1q6.sql.

answer: Query to display name, job, hire date, and employee number for each employee, with
employee number appearing first:
7. Run your query in the file a1q6.sql
answer: To run the query in the file "a1q6.sql," use the appropriate SQL client or command-
line
SQL> @a1q6.sql

8. Create a query to display unique jobs from the EMP table.


answer: Query to display unique jobs from the EMP table:
SELECT DISTINCT job FROM emp;

9. Load a1q6.sql into the SQL buffer. Name the column headings Emp #, Employee, Job, and Hire Date
respectively. Rerun your query
answer: To load "a1q6.sql" into the SQL buffer and name the column headings, you can
execute SQL> SET HEADING ON
SQL> COLUMN empno HEADING 'Emp #'
SQL> COLUMN ename HEADING 'Employee'
SQL> COLUMN job HEADING 'Job'
SQL> COLUMN hiredate HEADING 'Hire Date'
SQL> @a1q6.sql

10. Display the name concatenated with the job, separated by a comma and
space, and name the column Employee and Title.
answer: Query to display the name concatenated with the job, separated by a comma
and space, and name the column "Employee and Title":

SELECT ename || ', ' || job AS "Employee and Title"


FROM emp;

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy