Presentation is loading. Please wait.

Presentation is loading. Please wait.

 SQL statements are not case sensitive.  SQL statements can be on one or more lines.  Keywords cannot be abbreviated or split across lines.

Similar presentations


Presentation on theme: " SQL statements are not case sensitive.  SQL statements can be on one or more lines.  Keywords cannot be abbreviated or split across lines."— Presentation transcript:

1

2

3

4

5

6  SQL statements are not case sensitive.  SQL statements can be on one or more lines.  Keywords cannot be abbreviated or split across lines.  Clauses are usually placed on separate lines.  Tabs and indents are used to enhance readability. Writing SQL Statements

7 SQL(Structured Query Language) SQL classify the commands in four categories 1- Data Retrival Command. 2- Data Manipulation Language (DML) 3- Data Definition Language (DDL) 4- Data Control Language (DCL)

8 Data Retrival Command This category contains only one command: SELECT. This command is a cornerstone of SQL and allows users to query necessary data from the database. Becouse of its importance and widespread usage, if is often considerd in a separate category of its own.

9 Data Manipulation Language (DML) Commands in this category allow you to manipulate data in existing database objects. The most popular commands in this category are INSERT, UPDATE, and DELETE. Often it is necessary to use the SELECT command to specify the set of data that should be updated or deleted. This is the reson why SELECT sometimes is included in the DML category.

10 لغة معالجة البيانات : DML تتيح لك لغة معالجة البيانات DML القيام بالمهمات التالية : 1 - إدراج. 2 - تحديث UPDATE. 3 - حذف DELETE. 4 - تحديد SELECT البيانات في قاعدة البيانات. تتيح لك لغة DML العمل مع محتويات قاعدة بياناتك.

11 أمر SQLالغرض منه Insert Delete Update Select Commit work Rollback إضافة صفوف من البيانات إلى الجداول. حذف صفوف من البيانات من الجداول. تغيير البيانات الموجودة بالجدول. استعادة صفوف من البيانات من جدول/طريقة عرض. جعل التغييرات الخاصة بالعملية الحالية دائمة (كتابتها على القرص). التراجع عن كافة التغييرات التي أجريت منذ آخر عملية إيداع.

12 Data Definition Language (DDL) Commands in this category modify the structure of the database by creating, replacing, altering, or droping objects such as tables, indexes, and views.

13 لغة تعريف البيانات : DDL تتيح لك لغة تعريف البيانات DDL القيام بالمهمات التالية : 1 - إنشاء كائن قاعدة البيانات. 2 - إسقاط كائن قاعدة البيانات. 3 - تغيير كائن قاعدة البيانات. 4 - منح امتيازات استخدام كائن قاعدة البيانات. 5 - سحب امتيازات استخدام قاعدة البيانات.

14 Data Control Language (DCL) This category includes commands that protect the integrity of the database and the consistency of data by controlling and managing the acess to the database structures. These commands are often divided into transaction control commands session control commands, and system control commands. e.g. create, grand, trancate.

15

16

17

18

19

20

21

22

23

24

25 SQL and SQL*Plus Interaction SQL*Plus SQL Statements Buffer Server Query Results SQL*Plus Commands Commands Formatted Report

26 SQL and SQL*Plus SQL is a command language for communication with the Oracle Server from any tool or application. Oracle SQL contains many extensions. When you enter a SQL statement, it is stored in a part of memory called the SQL buffer and remains there until you enter a new statement. SQL*Plus is an Oracle tool that recognizes and submits SQL statements to the Oracle Server for execution and contains its own command language.

27 Features of SQL Can be used by a range of users, including those with little or no programming experience Is a nonprocedural language Reduces the amount of time required for creating and maintaining systems Is an English-like language

28 Features of SQL*Plus Accepts ad hoc entry of statements Accepts SQL input from files Provides a line editor for modifying SQL statements Controls environmental settings Formats query results into a basic report Accesses local and remote databases

29 SQL Statements Versus SQL*Plus Commands SQLstatements SQL A languageA language ANSI standardANSI standard Keyword cannot be abbreviatedKeyword cannot be abbreviated Statements manipulate data and table definitions in the databaseStatements manipulate data and table definitions in the databaseSQL*Plus An environmentAn environment Oracle proprietaryOracle proprietary Keywords can be abbreviatedKeywords can be abbreviated Commands do not allow manipulation of values in the databaseCommands do not allow manipulation of values in the database SQLbufferSQL*PluscommandsSQL*Plusbuffer

30

31

32

33 Capabilities of SQL SELECT Statements Selection Projection Table 1 Table 2 Table 1 Join

34 Basic SELECT Statement SELECT[DISTINCT] {*, column [alias],...} FROMtable; SELECT[DISTINCT] {*, column [alias],...} FROMtable; SELECT identifies what columns. FROM identifies which table. SELECT identifies what columns. FROM identifies which table.

35 Selecting All Columns DEPTNO DNAME LOC --------- -------------- ------------- 10 ACCOUNTING NEW YORK 20 RESEARCH DALLAS 30 SALES CHICAGO 40 OPERATIONS BOSTON SQL> SELECT * 2 FROM dept;

36 Selecting Specific Columns DEPTNO LOC --------- ------------- 10 NEW YORK 20 DALLAS 30 CHICAGO 40 BOSTON SQL> SELECT deptno, loc 2 FROM dept;

37

38

39

40


Download ppt " SQL statements are not case sensitive.  SQL statements can be on one or more lines.  Keywords cannot be abbreviated or split across lines."

Similar presentations


Ads by Google