Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter Four Objectives Introduction to SQL Introduction to iSQL*PLUS Types of SQL statements Concepts of DDL & DML Data Manipulation Language (DML)

Similar presentations


Presentation on theme: "Chapter Four Objectives Introduction to SQL Introduction to iSQL*PLUS Types of SQL statements Concepts of DDL & DML Data Manipulation Language (DML)"— Presentation transcript:

1 Chapter Four Objectives Introduction to SQL Introduction to iSQL*PLUS Types of SQL statements Concepts of DDL & DML Data Manipulation Language (DML)

2 2 SQL Structured Query Language Developed by IBM Used in most Commercial DBMS Statements are not case sensitive. Statements can be on one or more lines. Reserved words cannot be abbreviated or split over lines. Terminated with a semi colon. Statements are entered at SQL prompt. The subsequent lines are numbered (SQL buffer) Only one statement can be current at any time in the buffer.

3 3 Data Definition Language (DDL) Data Manipulation Language (DML) Types of SQL Statements

4 4 Example: Student(Name, ID, GPA, Major, B_Date) Course(C_Num, Dept, Title, Cr) Student_Course(ID, C_Num, Dept, Grade) Faculty(ID, Name, Dept, Salary, Area) Faculty_Course(ID, C_Num, Dept, Semester) Department Faculty _Status (Name, Num_Faculty) (Rank, Low_salary, High_salary)

5 5 Data Definition Language Name: User Identifiers: 1-30 characters Start with an alphabet Followed by alphabet, digit, _ Unique Not reserved Not case sensitive

6 6 Data Types Oracle Data Types: CHAR(size) VARCHAR2(max_size) NUMBER(n,d) DATE

7 7 Data Types: 1-Character: CHAR(Size) VARCHAR2(MaxSize) ‘4321’ ‘19 Main St. Frostburg’ ‘ * ’ ‘Student’’s ID’

8 8 Data Types: 2-Number: NUMBER NUMBER(T,D) 1,234,567.89NUMBER 1,234,567.89 1,234,567.89NUMBER(9) 1,234,567 1,234,567.89NUMBER(9,1) 1,234,567.8 1,234,567.89 NUMBER(7,-2) 1,234,500 1,234,567.89 NUMBER(6) ??

9 9 Data Types: 3-Date: DATE MyBirthdate = ‘11-JAN-37’ Default time 00:00:00 A.M. Use TO_DATE()

10 10 DESCRIBEStudent; NameNull?Type ---------------------------------------------------------- NAMEVARCHAR2(80) IDNUMBER(9) GPA NUMBER(3,2) B_DateDATE MajorCHAR(4) Display a Structure of a Table:

11 iSQL*PLUS iSQL*Plus consists of the following three layers: 1-Client layer (Web browser) 2-Middle layer (Oracle HTTP Server and iSQL*Plus Server) 3-Database layer (Oracle database and Oracle Net) 11

12 iSQL*PLUS Interface Configuration History Size: Set the number of scripts displayed in the script history. Input Area Size: Set the size of the script input area. -Width - Height 12

13 iSQL*PLUS Interface Configuration Output Location: Set where script output is displayed. -Below Input Area -Save to HTML File Set whether output is displayed on a single page, or over multiple pages. -Single page -Multiple pages Number of rows on each page 13

14 iSQL*PLUS Interface Configuration Show Line Numbers -On -Off Indent Attribute or Column Names -On -Off Whether commands in scripts are displayed in output as the script is executed. -On -Off 14

15 15 Changing the name of a table: RENAME student TO GradStudent;


Download ppt "Chapter Four Objectives Introduction to SQL Introduction to iSQL*PLUS Types of SQL statements Concepts of DDL & DML Data Manipulation Language (DML)"

Similar presentations


Ads by Google