You are on page 1of 3

SQL*Plus: Release 11.2.0.2.

0 Production on Sat Mar 13 08:52:13 2021

Copyright (c) 1982, 2014, Oracle. All rights reserved.

SQL> connect
Enter user-name: system
Enter password:
ERROR:
ORA-01017: invalid username/password; logon denied

SQL> connect
Enter user-name: sys as sysdba
Enter password:
Connected.
SQL> desc employee_table
Name Null? Type
----------------------------------------- -------- ----------------------------
EMP_NO VARCHAR2(15)
EMP_NAME VARCHAR2(10)
JOB VARCHAR2(10)
DEPT_NO VARCHAR2(8)
SALARY NUMBER(6)

SQL> select*from employee_table;

EMP_NO EMP_NAME JOB DEPT_NO SALARY


--------------- ---------- ---------- -------- ----------
19ue11558 fajar teacher t13 60000
19uec11559 jaggu temporary dept_no 15000
19ue11561 kaja doctor d1 80000
19ue11562 venkatesh temporary x12 15000

SQL> select*from employee_table where emp_name like '_a%';

EMP_NO EMP_NAME JOB DEPT_NO SALARY


--------------- ---------- ---------- -------- ----------
19ue11558 fajar teacher t13 60000
19uec11559 jaggu temporary dept_no 15000
19ue11561 kaja doctor d1 80000

SQL> select sum(salary) from employee_table;

SUM(SALARY)
-----------
170000

SQL> select avg(salary) from employee_table;

AVG(SALARY)
-----------
42500

SQL> select * from employee_table;

EMP_NO EMP_NAME JOB DEPT_NO SALARY


--------------- ---------- ---------- -------- ----------
19ue11558 fajar teacher t13 60000
19uec11559 jaggu temporary dept_no 15000
19ue11561 kaja doctor d1 80000
19ue11562 venkatesh temporary x12 15000

SQL> select emp_no,emp_name,dept_no from employee_table where job='temporary';

EMP_NO EMP_NAME DEPT_NO


--------------- ---------- --------
19uec11559 jaggu dept_no
19ue11562 venkatesh x12

SQL> SQL> update employee_table set dept_no='x12' where emp_no='19uec11559';

1 row updated.

SQL> select * from employee_table;

EMP_NO EMP_NAME JOB DEPT_NO SALARY


--------------- ---------- ---------- -------- ----------
19ue11558 fajar teacher t13 60000
19uec11559 jaggu temporary x12 15000
19ue11561 kaja doctor d1 80000
19ue11562 venkatesh temporary x12 15000

SQL> select distinct dept_no from employee_table;

DEPT_NO
--------
x12
d1
t13

SQL> select emp_no,emp_name,dept_no from employee_table salary between 40000 and


80000;
select emp_no,emp_name,dept_no from employee_table salary between 40000 and 80000
*
ERROR at line 1:
ORA-00933: SQL command not properly ended

SQL> select emp_no,emp_name,dept_no from employee_table where salary between 40000


and 80000;

EMP_NO EMP_NAME DEPT_NO


--------------- ---------- --------
19ue11558 fajar t13
19ue11561 kaja d1

SQL> select emp_no,emp_name,dept_no from employee_table where dept_no in


(t13,x12,d1);
select emp_no,emp_name,dept_no from employee_table where dept_no in (t13,x12,d1)
*
ERROR at line 1:
ORA-00904: "D1": invalid identifier

SQL> select emp_no,emp_name,dept_no from employee_table where dept_no in (t13,x12);


select emp_no,emp_name,dept_no from employee_table where dept_no in (t13,x12)
*
ERROR at line 1:
ORA-00904: "X12": invalid identifier

SQL> select emp_no,emp_name,dept_no from employee_table where dept_no in


('t13','x12');

EMP_NO EMP_NAME DEPT_NO


--------------- ---------- --------
19ue11558 fajar t13
19uec11559 jaggu x12
19ue11562 venkatesh x12

SQL> commit;

Commit complete.

You might also like