To select all data from table you use this cod
SELECT *
FROM EMP;
What's this
Select is reversed keyword
* Asterisk means all
FROM clause
EMP Name Of The Table Content Data
; Semicolon used to execute the statement
Example
If you want to see all information about departments
You will use same above syntaxes
But change the table name
SELECT *
FROM
DEPT
DEPTNO DNAME LOC
---------- -------------- -------------
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
Also you can display all columns by listing column name after select keyword as the flowing example
SELECT EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM
FROM EMP;
Again you can limit you can limit the columns display as the following
SELECT EMPNO, JOB
FROM EMP;
Result
EMPNO JOB
---------- ---------
7369 CLERK
7499 SALESMAN
7521 SALESMAN
7566 MANAGER
7654 SALESMAN
7698 MANAGER
7782 MANAGER
7788 ANALYST
7839 PRESIDENT
7844 SALESMAN
7876 CLERK
EMPNO JOB
---------- ---------
7900 CLERK
7902 ANALYST
7934 CLERK
No comments:
Post a Comment