Dbms Da-2: Sukriti Jaitly 18BCE0250
Dbms Da-2: Sukriti Jaitly 18BCE0250
18BCE0250
DBMS DA-2
create table employee(
FIRST_NAME VARCHAR2(20),
SALARY NUMBER(8),
COMMISION NUMBER(4,2),
MANAGER_ID NUMBER(6),
DEPARTMENT_ID NUMBER(4));
Table created.
(SALARY*12)+100
---------------
120100
120100
240100
LAST_NAME HIREDATE
------------------------- ---------
smith 19-OCT-95
SQL> select LAST_NAME,JOB_ID from employee where JOB_ID not in('IT_PROG','ST_cle
rk','sa-rep');
LAST_NAME JOB_ID
------------------------- -------------------------
sukriti 1
sam 2
smith 3
d='sales representative');
no rows selected
3 smith 19-OCT-95
1 sukriti 20-SEP-16
2 sam 20-DEC-17
no rows selected
SQL> select last_name,department_id from employee where hiredate like'%1995';
no rows selected
LAST_NAME DEPARTMENT_ID
------------------------- -------------
smith 3
no rows selected
LAST_NAME DEPARTMENT_ID
------------------------- -------------
sam 2
smith 3
SQL> select last_name from employee where first_name like ' a%';
no rows selected
SQL> select last_name from employee where first_name like ' y%';
LAST_NAME
-------------------------
sukriti
SQL> select last_name from employee where last_name like 'a%' and last_name like '%e';
no rows selected
SQL> select last_name from employee where last_name like 'a%' and last_name like '%l';
LAST_NAME
-------------------------
sukriti
SQL> select last_name ||', '||job_id as "employee and title" from employee;
----------------------------------------------------
sukriti, 1
sam, 2
smith, 3
sukriti 1 10000
sam 2 10000
smith 3 20000
Date
---------
20-SEP-16
20-DEC-17
19-OCT-95
AVG(SALARY)
-----------
13333.3333
SQL> select department_id from employee order by department_id asc;
DEPARTMENT_ID
-------------
FIRST_NAME
--------------------
harry
james
john
MIN(SALARY) MAX(SALARY)
----------- -----------
10000 20000
SQL> select count(*) from employee where salary>10000;
COUNT(*)
----------
SQL> select initcap(first_name) ||','|| emp_id as "name ,emp number" from employee;
-------------------------------------------------------------
John,1
James,2
Harry,3