The document contains examples of SQL queries on Oracle database tables. It shows how to retrieve data from the DEPT and EMP tables, including selecting columns, filtering rows, sorting results, and performing calculations. Various SQL functions are demonstrated like INITCAP, LENGTH, SUBSTR, and date formatting. The last section aggregates data from the EMP table using MAX, MIN, SUM, and AVG.
Using Machine Learning to Debug Oracle RAC IssuesAnil Nair
This deck was used at UKOUG 2018 to explain how Oracle Real Application Clusters (RAC) uses Machine Learning to make the job of Database Administrators easier.
Any DBA from beginner to advanced level, who wants to fill in some gaps in his/her knowledge about Performance Tuning on an Oracle Database, will benefit from this workshop.
Using Machine Learning to Debug Oracle RAC IssuesAnil Nair
This deck was used at UKOUG 2018 to explain how Oracle Real Application Clusters (RAC) uses Machine Learning to make the job of Database Administrators easier.
Any DBA from beginner to advanced level, who wants to fill in some gaps in his/her knowledge about Performance Tuning on an Oracle Database, will benefit from this workshop.
Introduction to Teradata And How Teradata WorksBigClasses Com
Watch How Teradata works with Introduction to teradata ,How Teradata Visual Explain Works,teradata database and tools,teradata database model,teradata hardware and software architecture,teradata database security,teradata storage based on primary index
Oracle 21c: New Features and Enhancements of Data Pump & TTSChristian Gohmann
At the end of the year 2020, Oracle released 21c on its Cloud infrastructure. The on-premises version will follow later this year. As with every new Oracle version, the Data Pump utility gets new features or enhancements for existing features.
This presentation gives an overview of the enhancements of Data Pump and Transportable Tablespaces. The following list is an excerpt of the points I will talk about
- Simultaneous use of EXCLUDE and INCLUDE
- Parallelized import of metadata during a TTS import operation
- Checksum support for dump files
- Direct access to Oracle Cloud Object Store for exports and imports
This presentation provides a clear overview of how Oracle Database In-Memory optimizes both analytics and mixed workloads, delivering outstanding performance while supporting real-time analytics, business intelligence, and reporting. It provides details on what you can expect from Database In-Memory in both Oracle Database 12.1.0.2 and 12.2.
Required for certification, window functions are powerful analytic functions built into SQL Server. SQL Server 2005 introduced the core window ranking functions, and SQL Server 2012 added time and statistical percentage window functions. These functions allow for advanced variable creation, and are of direct benefit to people creating features for data science. This talk will also recommend further reading on this topic.
مقدمة إلى وصف المصادر وإتاحتها / إعداد محمد عبدالحميد معوضMuhammad Muawwad
مقدمة إلى وصف المصادر وإتاحتها
RDA
محاضرة عامة عبر الإنترنت
Webinar
تحت رعاية الاتحاد العربي للمكتبات والمعلومات
المحاور
* تعريف بمعيار وصف المصادر وإتاحتها
* علاقة وصف المصادر وإتاحتها بعائلة المتطلبات الوظيفية
* علاقة وصف المصادر وإتاحتها بصيغ مارك 21 (الببليوجرافية والاستنادية)
* بنية وصف المصادر وإتاحتها (الخصائص - العلاقات - العناصر البؤرية)
Introduction to Teradata And How Teradata WorksBigClasses Com
Watch How Teradata works with Introduction to teradata ,How Teradata Visual Explain Works,teradata database and tools,teradata database model,teradata hardware and software architecture,teradata database security,teradata storage based on primary index
Oracle 21c: New Features and Enhancements of Data Pump & TTSChristian Gohmann
At the end of the year 2020, Oracle released 21c on its Cloud infrastructure. The on-premises version will follow later this year. As with every new Oracle version, the Data Pump utility gets new features or enhancements for existing features.
This presentation gives an overview of the enhancements of Data Pump and Transportable Tablespaces. The following list is an excerpt of the points I will talk about
- Simultaneous use of EXCLUDE and INCLUDE
- Parallelized import of metadata during a TTS import operation
- Checksum support for dump files
- Direct access to Oracle Cloud Object Store for exports and imports
This presentation provides a clear overview of how Oracle Database In-Memory optimizes both analytics and mixed workloads, delivering outstanding performance while supporting real-time analytics, business intelligence, and reporting. It provides details on what you can expect from Database In-Memory in both Oracle Database 12.1.0.2 and 12.2.
Required for certification, window functions are powerful analytic functions built into SQL Server. SQL Server 2005 introduced the core window ranking functions, and SQL Server 2012 added time and statistical percentage window functions. These functions allow for advanced variable creation, and are of direct benefit to people creating features for data science. This talk will also recommend further reading on this topic.
مقدمة إلى وصف المصادر وإتاحتها / إعداد محمد عبدالحميد معوضMuhammad Muawwad
مقدمة إلى وصف المصادر وإتاحتها
RDA
محاضرة عامة عبر الإنترنت
Webinar
تحت رعاية الاتحاد العربي للمكتبات والمعلومات
المحاور
* تعريف بمعيار وصف المصادر وإتاحتها
* علاقة وصف المصادر وإتاحتها بعائلة المتطلبات الوظيفية
* علاقة وصف المصادر وإتاحتها بصيغ مارك 21 (الببليوجرافية والاستنادية)
* بنية وصف المصادر وإتاحتها (الخصائص - العلاقات - العناصر البؤرية)
Slides from OpenWorld 2013 presentation.
Analytics have been there since 8.1.6, but they are still dramatically underused by application developers. This session looks at the syntax and usage of analytic functions, and how they can supercharge your SQL skillset.
These slides are from OpenWorld 2018. We covered
- conventional CONNECT BY syntax in Oracle
- extensions that were introduced in more recent versions
- the recursive WITH clause
Introduction to AI for Nonprofits with Tapp NetworkTechSoup
Dive into the world of AI! Experts Jon Hill and Tareq Monaur will guide you through AI's role in enhancing nonprofit websites and basic marketing strategies, making it easy to understand and apply.
Unit 8 - Information and Communication Technology (Paper I).pdfThiyagu K
This slides describes the basic concepts of ICT, basics of Email, Emerging Technology and Digital Initiatives in Education. This presentations aligns with the UGC Paper I syllabus.
Francesca Gottschalk - How can education support child empowerment.pptxEduSkills OECD
Francesca Gottschalk from the OECD’s Centre for Educational Research and Innovation presents at the Ask an Expert Webinar: How can education support child empowerment?
Synthetic Fiber Construction in lab .pptxPavel ( NSTU)
Synthetic fiber production is a fascinating and complex field that blends chemistry, engineering, and environmental science. By understanding these aspects, students can gain a comprehensive view of synthetic fiber production, its impact on society and the environment, and the potential for future innovations. Synthetic fibers play a crucial role in modern society, impacting various aspects of daily life, industry, and the environment. ynthetic fibers are integral to modern life, offering a range of benefits from cost-effectiveness and versatility to innovative applications and performance characteristics. While they pose environmental challenges, ongoing research and development aim to create more sustainable and eco-friendly alternatives. Understanding the importance of synthetic fibers helps in appreciating their role in the economy, industry, and daily life, while also emphasizing the need for sustainable practices and innovation.
Acetabularia Information For Class 9 .docxvaibhavrinwa19
Acetabularia acetabulum is a single-celled green alga that in its vegetative state is morphologically differentiated into a basal rhizoid and an axially elongated stalk, which bears whorls of branching hairs. The single diploid nucleus resides in the rhizoid.
How to Make a Field invisible in Odoo 17Celine George
It is possible to hide or invisible some fields in odoo. Commonly using “invisible” attribute in the field definition to invisible the fields. This slide will show how to make a field invisible in odoo 17.
2. SQL> desc dept
Name Null? Type
-----------------------------------------
DEPTNO NOT NULL NUMBER(2)
DNAME
LOC VARCHAR2(13)
-------------------------------------------------------------------------------------------
SQL> select *
2 from dept;
DEPTNO DNAME LOC
---------- -------------- -------------
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
ﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞ
Name Null? Type
----------------------------------------- -------- ----------------------------
DEPTNO NOT NULL NUMBER(2)
VARCHAR2(14)
LOC VARCHAR2(13)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3. SQL> select empno,ename,job,hiredate
2 from emp;
EMPNO ENAME JOB HIREDATE
---------- ---------- --------- --------
7369 SMITH CLERK 17/12/80
7499 ALLEN SALESMAN 20/02/81
7521 WARD SALESMAN 22/02/81
7566 JONES MANAGER 02/04/81
7654 MARTIN SALESMAN 28/09/81
7698 BLAKE MANAGER 01/05/81
7782 CLARK MANAGER 09/06/81
7788 SCOTT ANALYST 19/04/87
7839 KING PRESIDENT 17/11/81
7844 TURNER SALESMAN 08/09/81
7876 ADAMS CLERK 23/05/87
EMPNO ENAME JOB HIREDATE
---------- ---------- --------- --------
7900 JAMES CLERK 03/12/81
7902 FORD ANALYST 03/12/81
7934 MILLER CLERK 23/01/82
14 rows selected.
ﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞ
SQL> select empno,ename,job,hiredate
HIREDATE
--------
7369 SMITH CLERK 17/12/80
7499 ALLEN SALESMAN 20/02/81
7521 WARD SALESMAN 22/02/81
7566 JONES MANAGER 02/04/81
9/81
7698 BLAKE MANAGER 01/05/81
7782 CLARK MANAGER 09/06/81
7788 SCOTT ANALYST 19/04/87
7839 KING PRESIDENT 17/11/81
7844 TURNER SALESMAN 08/09/81
7876 ADAMS CLERK 23/05/87
EMPNO ENAME JOB HIREDATE
--------
7900 JAMES CLERK 03/12/81
7902 FORD ANALYST 03/12/81
7934 MILLER CLERK 23/01/82
4. SQL> select distinct job
2* from emp;
JOB
---------
CLERK
SALESMAN
PRESIDENT
MANAGER
ANALYST
ﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞ
5. SQL> select empno employee_no, ename employee_name, job jobs
2* from emp
EMPLOYEE_NO EMPLOYEE_N JOBS
----------- ---------- ---------
7369 SMITH CLERK
7499 ALLEN SALESMAN
7521 WARD SALESMAN
7566 JONES MANAGER
7654 MARTIN SALESMAN
7698 BLAKE MANAGER
7782 CLARK MANAGER
7788 SCOTT ANALYST
7839 KING PRESIDENT
7844 TURNER SALESMAN
7876 ADAMS CLERK
EMPLOYEE_NO EMPLOYEE_N JOBS
----------- ---------- ---------
7900 JAMES CLERK
7902 FORD ANALYST
7934 MILLER CLERK
14 rows selected.
ﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞ
SQL> select empno employee_no, ename employee_name, job jobs
6. الثالث الفصل أسئلة
SQL> select ename,sal
2 from emp
3 where sal>2850
4 order by sal desc;
ENAME SAL
---------- ----------
KING 5000
FORD 3000
SCOTT 3000
JONES 2975
ﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞ
الثالث الفصل أسئلة
7. SQL> select ename,sal
٢ from emp
٣ where sal not between 1500 and
ENAME SAL
--------------------
SMITH 800
WARD 1250
JONES 2975
MARTIN 1250
SCOTT 3000
KING 5000
ADAMS 1100
JAMES 950
FORD 3000
MILLER 1300
ﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞ
and 2850؛
8. SQL> select ename,sal
2 from emp
3 where(deptno=10 or deptno=30
4 order by sal desc;
ENAME SAL
---------- ----------
KING 5000
BLAKE 2850
CLARK 2450
ALLEN 1600
ﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞ
30) and sal>1500
9. SQL> select ename,hiredate
2 from emp
3 where hiredate like'%82';
ENAME HIREDATE
---------- --------
MILLER 23/01/82
=================================
SQL> select hiredate
from emp
where ename = 'SCOTT';
HIREDATE
---------
19-APR-87
ﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞ
بالسؤال كما النتيجة تظھر ال ملحوظةألن وذلك بالسؤال كما النتيجة تظھر ال ملحوظة
10. SQL> select ename,sal,comm
2 from emp
3 where comm is not null;
ENAME SAL COMM
---------- ---------- ----------
ALLEN 1600 300
WARD 1250 500
MARTIN 1250 1400
TURNER 1500 0
ﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞ
11. SQL> select ename
2 from emp
3 where ename like'__A%';
ENAME
----------
BLAKE
CLARK
ADAMS
ﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞ
12. SQL> select ename
2 from emp
3 where ename like'%LL%';
ENAME
----------
ALLEN
MILLER
ﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞ
13. 1 SQL> select initcap(ename) EMP_NAME,length(ename)
NUMBER1,substr(ename,0,4) SECTION
2* from emp
EMP_NAME NUMBER1 SECT
---------- ---------- ----
Smith 5 SMIT
Allen 5 ALLE
Ward 4 WARD
Jones 5 JONE
Martin 6 MART
Blake 5 BLAK
Clark 5 CLAR
Scott 5 SCOT
King 4 KING
Turner 6 TURN
Adams 5 ADAM
EMP_NAME NUMBER1 SECT
---------- ---------- ----
James 5 JAME
Ford 4 FORD
Miller 6 MILL
ﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞ
الرابع الفصل أسئلة
SQL> select initcap(ename) EMP_NAME,length(ename)
) SECTION
14. 1 SQL> select ename || job TITLE
2 from emp
3* where deptno=30
TITLE
-------------------
ALLENSALESMAN
WARDSALESMAN
MARTINSALESMAN
BLAKEMANAGER
TURNERSALESMAN
JAMESCLERK
ﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞ
SQL> select ename || job TITLE
15. 1 SQL> select ename ENAME,round((months_between(sysdate,hiredate)/
2* from emp
ENAME ROUND((MONTHS_BETWEEN(SYSDATE,HIREDATE)/12),0)
---------- ----------------------------------------------
SMITH
ALLEN 29
WARD 29
JONES 29
MARTIN
BLAKE 29
CLARK 29
SCOTT 23
KING 28
TURNER
ADAMS 23
ENAME ROUND((MONTHS_BETWEEN(SYSDATE,HIREDATE)/12),0)
---------- ----------------------------------------------
JAMES
FORD 28
MILLER 28
ﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞ
select ename ENAME,round((months_between(sysdate,hiredate)/
ENAME ROUND((MONTHS_BETWEEN(SYSDATE,HIREDATE)/12),0)
----------------------------------------------
29
ALLEN 29
WARD 29
JONES 29
MARTIN 28
BLAKE 29
CLARK 29
SCOTT 23
KING 28
28
ADAMS 23
ENAME ROUND((MONTHS_BETWEEN(SYSDATE,HIREDATE)/12),0)
----------------------------------------------
28
FORD 28
MILLER 28
select ename ENAME,round((months_between(sysdate,hiredate)/12),0)
16. SQL > select TO_CHAR(SYSDATE,'DAY "OF" MM YYYY')
2* from dual
TO_CHAR(SYSDATE,'DAY
--------------------
FRIDAY OF 03 2010
ﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞ
SQL > select TO_CHAR(SYSDATE,'DAY "OF" MM YYYY')
17. SQL> Select to_date( ' FEBRUARY
2 From dual;
TO_DATE
---------
22-FEB-04
ﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞ
SQL> Select to_date( ' FEBRUARY 22, 2004','mm / dd/yyyy')
18. SQL> select max(sal) MAXIMUM,min(sal) NINIMUM,sum(sal) SUM,round(avg(sal))
AVERAGE
;from emp
MAXIMUM NINIMUM SUM AVERAGE
----------------------------------------
5000 800 29025 2073
ﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞ
الخامس الفصل أسئلة
SQL> select max(sal) MAXIMUM,min(sal) NINIMUM,sum(sal) SUM,round(avg(sal))
MAXIMUM NINIMUM SUM AVERAGE
SQL> select max(sal) MAXIMUM,min(sal) NINIMUM,sum(sal) SUM,round(avg(sal))
19. SQL> select job,max(sal) as MAXIMUM,min(sal) as MINIMUM
from emp
;group by job
JOB MAXIMUM MINIMUM
-----------------------------
CLERK 1300 800
SALESMAN 1600 1250
PRESIDENT 5000 5000
MANAGER 2975 2450
ANALYST 3000 3000
ﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞ
ob,max(sal) as MAXIMUM,min(sal) as MINIMUM
20. SQL> select job,count(job)
from emp
group by job;
JOB COUNT(JOB)
-------------------
CLERK 4
SALESMAN 4
PRESIDENT 1
MANAGER 3
ANALYST 2
ﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞ
21. SQL> select count(distinct mgr) ‘NUMBER
;from emp
NUMBER1 OF MANAGER
------------------
6
ﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞ
‘NUMBER1 OF MANAGER’
22. SQL> select e.ename,e.deptno,d.dname
2 from emp e,dept d
3 where e.deptno=d.deptno
4* and e.deptno=30;
ENAME DEPTNO DNAME
---------- ---------- --------------
ALLEN 30 SALES
WARD 30 SALES
MARTIN 30 SALES
BLAKE 30 SALES
TURNER 30 SALES
JAMES 30 SALES
6 rows selected.
ﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞ
SQL> select e.ename,e.deptno,d.dname
23. SQL> select distinct( e.job),d.loc
2 from emp e,dept d
3 where e.deptno=d.deptno
4* and e.deptno=30;
JOB LOC
--------- -------------
SALESMAN CHICAGO
MANAGER CHICAGO
CLERK CHICAGO
ﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞ
c
24. SQL> select e.ename,e.job,d.dname
2 from emp e,dept d
3 where e.deptno=d.deptno
4* and d.loc like 'DALLAS'
ENAME JOB DNAME
---------- --------- --------------
SMITH CLERK RESEARCH
JONES MANAGER RESEARCH
SCOTT ANALYST RESEARCH
ADAMS CLERK RESEARCH
FORD ANALYST RESEARCH
ﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞ
SQL> select e.ename,e.job,d.dname
25. SQL> select e.ename,e.job,d.dname,e.sal,s.grade
2 from emp e,dept d,salgrade s
3 where (e.deptno=d.deptno
4 and e.sal between s.losal and s.hisal)
5 and e.deptno=10
6* order by sal;
ENAME JOB DNAME
---------- --------- -------------- ----------
MILLER CLERK ACCOUNTING 1300 2
CLARK MANAGER ACCOUNTING 2450 4
KING PRESIDENT ACCOUNTING 5
ﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞ
> select e.ename,e.job,d.dname,e.sal,s.grade
and e.sal between s.losal and s.hisal)
ENAME JOB DNAME SAL GRADE
---------- ----------
MILLER CLERK ACCOUNTING 1300 2
CLARK MANAGER ACCOUNTING 2450 4
KING PRESIDENT ACCOUNTING 5000 5
26. SQL> select e.empno,e.ename,m.empno,m.ename
2 from emp e,emp m
3 where e.mgr=m.empno
4 and e.deptno=10;
EMPNO ENAME EMPNO ENAME
---------- ---------- ---------- ----------
7782 CLARK 7839 KING
7934 MILLER 7782 CLARK
ﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞ
SQL> select e.empno,e.ename,m.empno,m.ename
----------
27. SQL> select ename,hiredate
2 from emp
3 where deptno=(select deptno
4 from emp
5 where ename like 'BLAKE');
ENAME HIREDATE
---------- --------
ALLEN 20/02/81
WARD 22/02/81
MARTIN 28/09/81
BLAKE 01/05/81
TURNER 08/09/81
JAMES 03/12/81
6 rows selected.
ﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞ
28. SQL> select empno,ename
2 from emp
3 where sal> all(select avg(sal)
4 from emp)
5* order by sal desc;
EMPNO ENAME
---------- ----------
7839 KING
7902 FORD
7788 SCOTT
7566 JONES
7698 BLAKE
7782 CLARK
6 rows selected.
ﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞ
29. SQL> select ename,deptno,job
2 from emp
3 where deptno=(select deptno
4 from dept
5* where loc like 'DALLAS')
ENAME DEPTNO JOB
---------- ---------- ---------
SMITH 20 CLERK
JONES 20 MANAGER
SCOTT 20 ANALYST
ADAMS 20 CLERK
FORD 20 ANALYST
ﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞ
* where loc like 'DALLAS');
30. SQL> select empno,ename,job,sal
2 from emp
3 where sal< all(select sal
4 from emp
5 where job like 'SALESMAN')
6 and job<>'SALESMAN';
EMPNO ENAME JOB SAL
---------- ---------- --------- ----------
7369 SMITH CLERK 800
7876 ADAMS CLERK 1100
7900 JAMES CLERK 950
SQL> select sal
2 from emp
3 where job like 'SALESMAN';
SAL
----------
1600
1250
1250
1500
ﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞ
SQL> select empno,ename,job,sal
where job like 'SALESMAN')
EMPNO ENAME JOB SAL
----------
7369 SMITH CLERK 800
CLERK 1100
7900 JAMES CLERK 950
31. SQL> select ename,deptno,sal
2 from emp
3 where (sal,deptno) in (select sal,deptno
4 from emp
5 where comm is not null)
6 order by sal;
ENAME DEPTNO SAL
---------- ---------- ----------
MARTIN 30 1250
WARD 30 1250
TURNER 30 1500
ALLEN 30 1600
SQL> spool off
ﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞ
ere (sal,deptno) in (select sal,deptno
where comm is not null)
ENAME DEPTNO SAL
MARTIN 30 1250
WARD 30 1250
ALLEN 30 1600
32. SQL> select distinct e.ename,dal.dname ,e.sal
2 from emp e,(select m.sal,m.comm,d.dname
3 from emp m,dept d
4 where m.deptno=d.deptno
5 and d.loc = 'DALLAS')dal
6 where e.sal=dal.sal
7 and nvl(e.comm,0) = nvl(dal.comm,
8 order by sal;
ENAME DNAME SAL
---------- -------------- ----------
SMITH RESEARCH 800
ADAMS RESEARCH 1100
JONES RESEARCH 2975
FORD RESEARCH 3000
SCOTT RESEARCH 3000
ﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞ
SQL> select distinct e.ename,dal.dname ,e.sal
from emp e,(select m.sal,m.comm,d.dname
where m.deptno=d.deptno
and d.loc = 'DALLAS')dal
) = nvl(dal.comm,0)
33. SQL> select ename,hiredate,sal
2 from emp
3 where (sal,nvl(comm,0)) in (select sal,nvl(comm,
4 from emp
5 where ename = 'SCOTT')
6 and ename<>'SCOTT';
ENAME HIREDATE SAL
---------- -------- ----------
FORD 03/12/81 3000
SQL> spool off
ﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞ
)) in (select sal,nvl(comm,0)
ENAME HIREDATE SAL
FORD 03/12/81 3000
34. SQL>insert into emp
values(1111,'AHMED','ENGENEER',
1 row created.
============================================
commit
--
SQL >update emp
set sal=7000
where ename='AHMED';
1 row updated.
ﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞ
,'AHMED','ENGENEER',7839,'01-01-2004',5000,200,10);
===============
35. SQL> update emp
2 set sal = 1000
3 where sal<900;
1 row updated.
SQL>commit
ﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞ
36. SQL> delete from emp
2 where empno=1111;
1 row deleted.
ﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞ
37. SQL> insert into emp
2 values (&empno,&ename,&job,&mgr,&hiredate,&sal,&comm,&deptno);
Enter value for empno: 111
Enter value for ename: 'Moh_Suez'
Enter value for job: 'DBA'
Enter value for mgr: 0
Enter value for hiredate: '01-01-2010
Enter value for sal: 12000
Enter value for comm: 1200
Enter value for deptno: 10
old 2: values (&empno,&ename,&job,&mgr,&hiredate,&sal,&comm,&deptno)
new 2: values (111,'Moh_Suez','DBA',
1 row created.
ﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞ
values (&empno,&ename,&job,&mgr,&hiredate,&sal,&comm,&deptno);
Enter value for ename: 'Moh_Suez'
2010'
: values (&empno,&ename,&job,&mgr,&hiredate,&sal,&comm,&deptno)
,'Moh_Suez','DBA',0,'01-01-2010',12000,1200,10)
values (&empno,&ename,&job,&mgr,&hiredate,&sal,&comm,&deptno);
: values (&empno,&ename,&job,&mgr,&hiredate,&sal,&comm,&deptno)
38. SQL> create table department
(Id number(7),Name varchar2(25
ﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞ
25));
45. SQL> alter table employee
add constraint deptno_fk forign key(deptno) references dept(deptno);
Table altered.
SQL> alter table employee
add constraint sal_ck check(sal between
Table altered.
SQL> select constraint_name,column_name
from user_cons_column
where table_name='EMPLOYEE';
XXXXXXXXXXXXXXXXXX
SQL> select constraint-name,constraint_type
from user_constraint
where table_name='EMPLOYEE';
CONSTRAINT_NAME C
------------------------------ -
PK_EMP P
FK_DEPTNO R
ﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞﺣـــــــﻞ
add constraint deptno_fk forign key(deptno) references dept(deptno);
al between 1000 and 5000);
SQL> select constraint_name,column_name
where table_name='EMPLOYEE';
name,constraint_type
where table_name='EMPLOYEE';