Difference between revisions of "Oracle:Section1"
From mi-linux
Jump to navigationJump to searchm (Protected "Oracle:Section1" ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))) |
|||
Line 78: | Line 78: | ||
14 rows selected. | 14 rows selected. | ||
</pre> | </pre> | ||
+ | |||
+ | |||
+ | ---- | ||
+ | |||
+ | Return to the [[Oracle_Workbook|Workbook]]. |
Latest revision as of 16:09, 2 March 2016
Main Page >> Oracle and SQL >> Workbook >> Section 1 answers
Answers to Section 1
You should only look at the answers once you have attempted them yourself!
Exercise 1.1 Type in the SQL code to display the structure of the CUSTOMER table.
DESC CUSTOMER
The result should be similar to the following:
Name Null? Type ----------------------------------------- -------- ---------------------------- CNO NUMBER(4) ORDERDATE DATE NAME VARCHAR2(15) CITY VARCHAR2(15) COUNTRY VARCHAR2(15) PNO NUMBER(4) DESCRIPTION VARCHAR2(20) QTY NUMBER(4)
Type in the following commands separately:
describe dept
Shows the structure of the dept table
select * from dept;
Shows the contents of the dept table (data)
select * from emp;
Shows the contents of the emp table (data)
describe salgrade
Shows the structure of the salgrade table
select * from salgrade;
Shows the contents of the salgrade table (data)
Exercise 1.2
Now try and retrieve the employee's name, hiredate and sal:
SELECT ENAME, HIREDATE, SAL FROM EMP;
The results should be similar to:
ENAME HIREDATE SAL ---------- --------- ---------- KING 17-NOV-81 5000 JONES 02-APR-81 2975 SCOTT 09-DEC-82 3000 ADAMS 12-JAN-83 1100 FORD 03-DEC-81 3000 SMITH 17-DEC-80 800 BLAKE 01-MAY-81 2850 ALLEN 20-FEB-81 1600 WARD 22-FEB-81 1250 MARTIN 28-SEP-81 1250 TURNER 08-SEP-81 1500 JAMES 03-DEC-81 950 CLARK 09-JUN-81 2450 MILLER 23-JAN-82 1300 14 rows selected.
Return to the Workbook.