Paghunasnarobertoactivity 1
Paghunasnarobertoactivity 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:
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
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":