1 / 40

SQL statements are not case sensitive. SQL statements can be on one or more lines.

Writing SQL Statements. 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. SQL(Structured Query Language).

lani-lawson
Download Presentation

SQL statements are not case sensitive. SQL statements can be on one or more lines.

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. 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)

  3. 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.

  4. 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.

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

  6. 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.

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

  8. 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.

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

  10. 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 bufferand remains there until you enter a new statement. • SQL*Plusis an Oracle tool that recognizes and submits SQL statements to the Oracle Server for execution and contains its own command language.

  11. 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

  12. 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

  13. SQL Statements Versus SQL*Plus Commands • SQL • A language • ANSI standard • Keyword cannot be abbreviated • Statements manipulate data and table definitions in the database • SQL*Plus • An environment • Oracle proprietary • Keywords can be abbreviated • Commands do not allow manipulation of values in the database SQL statements SQL buffer SQL*Plus commands SQL*Plus buffer

  14. Capabilities of SQL SELECT Statements Projection Selection Table 1 Table 1 Join Table 2 Table 1

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

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

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

More Related