Practice 1 to 15 And Answers - Practice 1 Answers 1....

This preview shows page 1 - 5 out of 47 pages.

The preview shows page 4 - 5 out of 47 pages.
Practice 1 Answers1. Initiate a SQL* Plus session using the user ID and password provided by the instructor.2. SQL* Plus commands access the database
3. Will the SELECT statement execute successfully?
4. Will the SELECT statement execute successfully?
5. There are four coding errors in this statement. Can you identify them?"
6. Show the structure of the DEPT table. Select all data from the DEPT table.
7. 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 youSQL statement to a file named p1q.sql.
desc empSELECT empno, ename,job, hiredateFROM emp8. Run your query in the file p1q7.sql.
9. Create a query to display unique jobs from the EMP table.
10. Load plq7.sql into the SQL buffer. Name the column headings Emp#. Employee, Joband Hire Date, Respectively. Return your query.
11. Display the name concatenated with the job, separated by a comma and space, and namethe column: Employee and Title.SELECT ename||', '||job "Employee and Title"FROM empIf you want extra challenge, complete the following exercise:12. Create a query to display all the data from the EMP table. Separate each column by acomma. Name the column THE_OUTPUT.SELECT empno || ',' || ename || ','|| job || ',' ||mgr || ',' || hiredate || ',' || sal || ',' ||comm || ',' || deptno THE_OUTPUTFROM emp
Practice 2Answers1. Create query to display the name and salary of employees earning more than $2850. Saveyour SQL statement to a file named p2ql.sql. Run your query.
2. Create a query to display the employee name and department number for employeenumber 7566.
3. Modify p2ql.sql to display the name and salary for all employees whose salary is not in therange of $1500 and $2850. Resave your SQL statement to a file named p2q3.sql. Rerun yourquery.
4. Display the employee name, job, and start date of employees hired between February 20,1981 and May 1, 1981. Order the query in ascending order by start date.
5. Display the employee name and department number of all employees in departments 10and 30 in alphabetical order by name.
6. Modify p2q3.sql to list the name and salary of employees who earn more than $1500 andare in department 10 or 30. Label the columns Employee and Monthly Salary respectively.

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 47 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Summer
Professor
N/A
Tags
emp

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture