Much from Introduction to Oracle:SQL and PL/SQL, Oracle University 1 Basic SQL Statements Oracle/SQL Plus Commands Kroenke, 11 th ed., Chapter Two.

Slides:



Advertisements
Similar presentations
Copyright  Oracle Corporation, All rights reserved. 1 Writing Basic SQL Statements.
Advertisements

1Eyad Alshareef Enhanced Guide to Oracle 10g Chapter 3: Using SQL Queries to Insert, Update, Delete, and View Data.
Introduction to Structured Query Language (SQL)
Let’s try Oracle. Accessing Oracle The Oracle system, like the SQL Server system, is client / server. For SQL Server, –the client is the Query Analyser.
Introduction to Structured Query Language (SQL)
1 Copyright © Oracle Corporation, All rights reserved. Writing Basic SQL SELECT Statements.
A Guide to SQL, Seventh Edition. Objectives Understand the concepts and terminology associated with relational databases Create and run SQL commands in.
Writing Basic SQL statement 2 July July July Create By Pantharee Sawasdimongkol.
Introduction to Structured Query Language (SQL)
A Guide to MySQL 3. 2 Objectives Start MySQL and learn how to use the MySQL Reference Manual Create a database Change (activate) a database Create tables.
WRITING BASIC SQL SELECT STATEMENTS Lecture 7 1. Outlines  SQL SELECT statement  Capabilities of SELECT statements  Basic SELECT statement  Selecting.
Chapter 1 Writing Basic SQL Statements Important Legal Notice:  Materials on this lecture are from a book titled “Oracle Education” by Kochhar, Gravina,
Copyright  Oracle Corporation, All rights reserved. Introduction.
Ceng 356-Lab1. Objectives After completing this lesson, you should be able to do the following: Get Familiar with the development environment List the.
1 Copyright © Oracle Corporation, All rights reserved. Writing Basic SQL SELECT Statements.
Session 5: Working with MySQL iNET Academy Open Source Web Development.
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 7 INTRODUCTION TO STRUCTURED QUERY LANGUAGE (SQL) Instructor Ms. Arwa.
1 Copyright © 2006, Oracle. All rights reserved. Retrieving Data Using the SQL SELECT Statement.
4-1 Copyright  Oracle Corporation, All rights reserved. Data Manipulation Language (DML)
Copyright  Oracle Corporation, All rights reserved. 1 Writing Basic SQL Statements.
CS 3630 Database Design and Implementation. Your Oracle Account UserName is the same as your UWP username Followed Not case sensitive Initial.
CPS120: Introduction to Computer Science Lecture 19 Introduction to SQL.
After completing this lesson, you should be able to do the following: List the capabilities of MySQL SELECT statements Execute a basic SELECT statement.
Database control Introduction. The Database control is a tool that used by the database administrator to control the database. To enter to Database control.
2 Writing Basic SELECT Statements. 1-2 Copyright  Oracle Corporation, All rights reserved. Capabilities of SQL SELECT Statements Selection Projection.
Copyright  Oracle Corporation, All rights reserved. Writing Basic SQL Statements.
Copyright س Oracle Corporation, All rights reserved. I Introduction.
RELATSIOONILISED ANDMEBAASID(alg) SQLi VÕIMALUSED.
7 1 Chapter 7 Introduction to Structured Query Language (SQL) Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
LECTURE 1 INTRODUCTION TO PL/SQL Tasneem Ghnaimat.
Oracle 11g DATABASE DEVELOPMENT LAB1. Introduction  Oracle 11g Database:-  Oracle 11g database is designed for some features, which helps to the organizations.
6 1 Lecture 8: Introduction to Structured Query Language (SQL) J. S. Chou, P.E., Ph.D.
Session 2: SQL (A): Parts 1 and 2 Original materials supplied by the Oracle Academic Initiative (OAI). Edited for classroom use by Professor Laku Chidambaram.
A Guide to MySQL 3. 2 Introduction  Structured Query Language (SQL): Popular and widely used language for retrieving and manipulating database data Developed.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
Introduction to SQL PART Ⅰ 第一讲 Writing Basic SQL SELECT Statements.
SQL Fundamentals  SQL: Structured Query Language is a simple and powerful language used to create, access, and manipulate data and structure in the database.
Copyright  Oracle Corporation, All rights reserved. Introduction.
SQL: Part 1 Original materials supplied by the Oracle Academic Initiative (OAI). Edited for classroom use by Professor Laku Chidambaram. Not for commercial.
Database Fundamental & Design by A.Surasit Samaisut Copyrights : All Rights Reserved.
1 Writing Basic SQL Statements. 1-2 Objectives At the end of this lesson, you should be able to: List the capabilities of SQL SELECT statements Execute.
I-1 Copyright س Oracle Corporation, All rights reserved. Data Retrieval.
SQL: Part 2 Original materials supplied by the Oracle Academic Initiative (OAI). Edited for classroom use by Professor Laku Chidambaram. Not for commercial.
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 7 (Part II) INTRODUCTION TO STRUCTURED QUERY LANGUAGE (SQL) Instructor.
1 Copyright © Oracle Corporation, All rights reserved. Writing Basic SQL SELECT Statements.
Copyright س Oracle Corporation, All rights reserved. I Introduction.
1-1 Copyright  Oracle Corporation, All rights reserved. Logging In to SQL*Plus From Windows environment:From Windows environment: From command line:From.
7 1 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel 7.6 Advanced Select Queries SQL provides useful functions that.
9/29/2005From Introduction to Oracle:SQL and PL/SQL, Oracle 1 Restricting and Sorting Data Kroenke, Chapter Two.
Writing Basic SQL Statements. Objectives After completing this lesson, you should be able to do the following: –List the capabilities of SQL SELECT statements.
LM 5 Introduction to SQL MISM 4135 Instructor: Dr. Lei Li.
 CONACT UC:  Magnific training   
SQL Statements SELECT INSERTUPDATEDELETECREATEALTERDROPRENAMETRUNCATECOMMITROLLBACKSAVEPOINTGRANTREVOKE Data Retrieval Language (DRL) Data Retrieval Language.
1 Copyright © 2007, Oracle. All rights reserved. Retrieving Data Using the SQL SELECT Statement.
Oracle 10g Retrieving Data Using the SQL SELECT Statement.
1 Copyright © 2009, Oracle. All rights reserved. Retrieving Data Using the SQL SELECT Statement.
Copyright  Oracle Corporation, All rights reserved. Introduction.
Copyright س Oracle Corporation, All rights reserved. 1 Writing Basic SQL Statements.
1 Copyright © 2004, Oracle. All rights reserved. Retrieving Data Using the SQL SELECT Statement.
D Copyright © 2009, Oracle. All rights reserved. Using SQL*Plus.
RELATSIOONILISED ANDMEBAASID (algus , ORACLE materjalid)
Retrieving Data Using the SQL SELECT Statement
Writing Basic SQL SELECT Statements
SQL and SQL*Plus Interaction
Writing Basic SQL SELECT Statements
ORACLE SQL Developer & SQLPLUS Statements
Writing Basic SQL SELECT Statements
Writing Basic SQL Statements
Using SQL*Plus.
Presentation transcript:

Much from Introduction to Oracle:SQL and PL/SQL, Oracle University 1 Basic SQL Statements Oracle/SQL Plus Commands Kroenke, 11 th ed., Chapter Two

Much from Introduction to Oracle:SQL and PL/SQL, Oracle University 2 Relational Database Concept Model proposed –E. F. Codd –1970 Basis for Relational Database Management Systems (RDMS) Basis for Oracle

Much from Introduction to Oracle:SQL and PL/SQL, Oracle University 3 The Key Characteristic of Databases: Related Tables

Much from Introduction to Oracle:SQL and PL/SQL, Oracle University 4 Relational Database Definition A self-describing collection of integrated relations. Table: EMP Table: DEPT DEPTNODNAMELOC 10ACCOUNTINGNEW YORK 20RESEARCHDALLAS 30SALESCHICAGO 40OPERATIONSBOSTON EMPNOENAMEJOBDEPTNO 7839KINGPRESIDENT BLAKEMANAGER CLARKMANAGER JONESMANAGER20

Much from Introduction to Oracle:SQL and PL/SQL, Oracle University 5 The Relational Model Collection of objects or relations to store data & describe the database. Set of operators to act on relations Data integrity constraints to govern related tables

Much from Introduction to Oracle:SQL and PL/SQL, Oracle University 6 Structured Query Language SQL(sequel) Communicate with server to –Access, –Manipulate, and –Control data

Much from Introduction to Oracle:SQL and PL/SQL, Oracle University 7 SELECT Statements Access Data Produce tables

Much from Introduction to Oracle:SQL and PL/SQL, Oracle University 8 Capabilities of SELECT Statements Selection: returns rows restricted by some criteria Projection: returns specified columns Join: brings together rows in different tables.

Much from Introduction to Oracle:SQL and PL/SQL, Oracle University 9 Capabilities of SQL SELECT Statements SelectionProjection Table 1

Much from Introduction to Oracle:SQL and PL/SQL, Oracle University 10 Capabilities of SQL SELECT Statements Join Table 1 Table 2

Much from Introduction to Oracle:SQL and PL/SQL, Oracle University 11 Relational Algebra Module

Much from Introduction to Oracle:SQL and PL/SQL, Oracle University 12 The Results of an SQL SELECT Statement Is a table!!! Never puts stuff into existing tables

Much from Introduction to Oracle:SQL and PL/SQL, Oracle University 13 Basic SELECT Statement SELECT identifies what columns. FROM identifies which table. SELECT [DISTINCT] {*, column [ alias ],...} FROM table;

Much from Introduction to Oracle:SQL and PL/SQL, Oracle University 14 Finding Oracle Programming Applications folder on desktop Oracle – OraDB11g-home1 folder Application Development folder SQL Plus

Much from Introduction to Oracle:SQL and PL/SQL, Oracle University 15 To Log On tiger

Much from Introduction to Oracle:SQL and PL/SQL, Oracle University 16 Some Uses for Spool Files Can be viewed in NotePad or Word Can be edited to create the same changes on another computer –Delete everything except SQL statements –At home, run the edited file. Start fullpathfilename

Much from Introduction to Oracle:SQL and PL/SQL, Oracle University 17 Using the spool file  Look at the file name (no spaces in the path)

Much from Introduction to Oracle:SQL and PL/SQL, Oracle University 18 Column Heading Defaults of Three Data Types Date and character data –Left justified –Upper case –Date  DD-MON-YY Numeric data –Right justified –Upper case

Much from Introduction to Oracle:SQL and PL/SQL, Oracle University 19 Arithmetic Expressions Create new values From base table data Do not change base table data

Much from Introduction to Oracle:SQL and PL/SQL, Oracle University 20 Operator Precedence Like Algebra Evaluate * and / before + and - Evaluate from left to right Parenthesis override No exponentiation operator exists

Much from Introduction to Oracle:SQL and PL/SQL, Oracle University 21 Null Values Unavailable, unassigned, inapplicable NOT the same as zero or blank Defined within the context of specific database Nvl(column, value)

Much from Introduction to Oracle:SQL and PL/SQL, Oracle University 22 Column Aliases Two formats –SELECT column AS alias –SELECT column alias Be consistent in style Double quotes around the alias allow –Mixed case –Spaces

Much from Introduction to Oracle:SQL and PL/SQL, Oracle University 23 DESCRIBE tablename Describes structure of existing table A SQL Plus command

Much from Introduction to Oracle:SQL and PL/SQL, Oracle University 24 DatatypeDescription NUMBER(p.s)Number value having a maximum number of digits p. the number of digits to the right of the decimal point s VARCHAR2(s)Variable-length character value of maximum size s DATEDate and time value between Jan. 1, 4712 B.C. and Dec. 31, 9999 A.D. CHAR(s)Fixed-length character value of size s

Much from Introduction to Oracle:SQL and PL/SQL, Oracle University 25 SQL*Plus File Commands SAVE filename GET filename START filename EDIT filename SPOOL filename EXIT

Much from Introduction to Oracle:SQL and PL/SQL, Oracle University 26 SQL Statements vs SQL*Plus Commands SQL A language ANSI standard Keyword NOT abbreviated Statements manipulate data & table definitions in DB SQL*Plus An environment Oracle proprietary Keywords can be abbreviated Commands do NOT manipulate table structure or values in DB

Much from Introduction to Oracle:SQL and PL/SQL, Oracle University 27 Server Buffer SQL*Plus SQL Statements SQL*Plus Commands Query Results Formatted Report

Much from Introduction to Oracle:SQL and PL/SQL, Oracle University 28 Do Practice 1 Practice 1 – Basic SQL SELECT Statements.doc