Introduction to Oracle9i: SQL1 Selected Single-Row Functions.

Slides:



Advertisements
Similar presentations
Copyright  Oracle Corporation, All rights reserved. 2 Single-Row Functions.
Advertisements

Objectives After completing this lesson, you should be able to do the following: Describe various types of conversion functions that are available in.
Copyright © 2007, Oracle. All rights reserved Using Single-Row Functions to Customize Output Modified: October 21, 2014.
Chapter 11 Group Functions
Introduction to Oracle9i: SQL1 Subqueries. Introduction to Oracle9i: SQL2 Chapter Objectives Determine when it is appropriate to use a subquery Identify.
Databases Lab 5 Further Select Statements. Functions in SQL There are many types of functions provided. The ones that are used most are: –Date and Time.
Introduction to Oracle9i: SQL1 SQL Group Functions.
Introduction to PL/SQL
Using Single-Row Functions to Customize Output
Lecture 6 29/1/15. Number functions Number functions take numbers as input, change them, and output the results as numbers. 2.
SQL Use of Functions Character functions Please use speaker notes for additional information!
Ch. 3 Single-Row Functions Important Legal Notice:  Materials on this lecture are from a book titled “Oracle Education” by Kochhar, Gravina, and Nathan.
Single-Row Functions. SQL Functions Functions are a very powerful feature of SQL and can be used to do the following: Perform calculations on data Modify.
3-1 Copyright  Oracle Corporation, All rights reserved. SQL Functions FunctionInput arg 1 arg 2 arg n Function performs action OutputResultvalue.
3 Single-Row Functions. 3-2 Objectives At the end of this lesson, you should be able to: Describe various types of functions available in SQL Use character,
Chapter 6 Group Functions. Chapter Objectives  Differentiate between single-row and multiple-row functions  Use the SUM and AVG functions for numeric.
Oracle FUNCTIONS. Comment ScreenShot (in 10g) General Example of null Foreign Key: create table deptcs( deptno NUMBER(4) primary key, hiredate DATE,
Number Functions. 2 home back first prev next last Review single-row character functions –character case-manipulation functions  LOWER, UPPER, INITCAP.
3 Copyright © Oracle Corporation, All rights reserved. Single-Row Functions.
Chapter 10 Selected Single-Row Functions Oracle 10g: SQL.
Chapter 5 Selected Single-Row Functions. Chapter Objectives  Use the UPPER, LOWER, and INITCAP functions to change the case of field values and character.
Single-Row Functions. Two Types of SQL Functions There are two distinct types of functions: Single-row functions Multiple-row functions Single-Row Functions.
SINGLE-ROW FUNCTIONS Lecture 9. SQL Functions Functions are very powerful feature of SQL and can be used to do the following:  Perform a calculation.
Functions Oracle Labs 5 & 6. 2/3/2005Adapted from Introduction to Oracle: SQL and PL/SQL 2 SQL Functions Function arg n arg 2 arg 1. Input Resulting Value.
1 Data Manipulation in SQL  Department of Computer Science Northern Illinois University February 2001.
3 Copyright © 2004, Oracle. All rights reserved. Using Single-Row Functions to Customize Output.
Single – Row Functions. Objectives After completing this lesson, you should be able to do the following:  Describe various types of functions available.
Copyright  Oracle Corporation, All rights reserved. 3 Single-Row Functions.
Single Row Functions Week 2. Objectives –Describe types of single row functions in SQL –Describe and use character, number, date, general and conversion.
Oracle 11g: SQL Chapter 10 Selected Single-Row Functions.
SQL Oracle PL/SQL. Select SELECT column1, column2,...columnN FROM table_name WHERE condition; SELECT column1, column2,...columnN FROM table_name WHERE.
Chapter 3 Selected Single-Row Functions and Advanced DML & DDL.
6 Copyright © 2006, Oracle. All rights reserved. Using Single-Row Functions to Customize Output.
2-1 Copyright © Oracle Corporation, All rights reserved. Using the NULL Conditions Test for nulls with the IS NULL operator. SELECT last_name, manager_id.
EXPRESSION Transformation. Introduction ►Transformations help to transform the source data according to the requirements of target system and it ensures.
Advanced SELECT Queries CS 146. Review: Retrieving Data From a Single Table Syntax: Limitation: Retrieves "raw" data Note the default formats… SELECT.
IFS Intro to Data Management Chapter 5 Getting More Than Simple Columns.
Single Row Functions. Objectives –Use character, number, and date functions –Use conversion functions –Describe types of single row functions in SQL.
Lecture 8 – SQL Joins – assemble new views from existing tables INNER JOIN’s The Cartesian Product Theta Joins and Equi-joins Self Joins Natural Join.
Copyright  Oracle Corporation, All rights reserved. 3 Single-Row Functions.
INTRODUCTION TO SQL Chapter SELECT * FROM teacher WHERE INSTR (subject_id, ‘&1’)= 4 AND LOWER (subject_id) LIKE ‘HST%’ ; When prompted for the.
3 Copyright © 2009, Oracle. All rights reserved. Using Single-Row Functions to Customize Output.
3 Copyright © Oracle Corporation, All rights reserved. Single-Row Functions.
Copyright س Oracle Corporation, All rights reserved. 3 Single-Row Functions.
3 Copyright © Oracle Corporation, All rights reserved. Single-Row Functions.
3 第三讲 Single-Row Functions. Objectives After completing this lesson, you should be able to do the following: Describe various types of functions available.
6 Copyright © Oracle Corporation, All rights reserved. Subqueries.
SQL Functions. SQL functions are built into Oracle Database and are available for use in various appropriate SQL statements. These functions are use full.
Introduction to Functions – Single Row Functions.
Built-in SQL Functions. 2 Type of Functions Character Functions returning character values returning numeric values Numeric Functions Date Functions Conversion.
Using Single-Row Functions to Customize Output
Oracle & SQL. Oracle Data Types Character Data Types: Char(2) Varchar (20) Clob: large character string as long as 4GB Bolb and bfile: large amount of.
3 Copyright © 2007, Oracle. All rights reserved. Substitution Variables ra Oly l&On nase lce Int erU.
4/2/16. Ltrim() is used to remove leading occurrences of characters. If we don’t specify a character, Oracle will remove leading spaces. For example Running.
1 Inside Module 8 Extracting Data Page n Using the Extract command2 n Coercion3 n $-functions4 n Extract from a table7.
Gollis University Faculty of Computer Engineering Chapter Five: Retrieval, Functions Instructor: Mukhtar M Ali “Hakaale” BCS.
Chapter 7 Subqueries. Chapter Objectives  Determine when it is appropriate to use a subquery  Identify which clauses can contain subqueries  Distinguish.
3 Copyright © 2009, Oracle. All rights reserved. Using Single-Row Functions to Customize Output.
Single Row Functions. 3-2 Objectives Explain the various types of functions available in SQL. Explain the various types of functions available in SQL.
Copyright  Oracle Corporation, All rights reserved. 3 Single-Row Functions.
Single Row Functions Part I Week 2. Objectives –Describe types of single row functions in SQL –Describe and use character, number and date SQL functions.
Open Source Server Side Scripting MySQL Functions
Chapter 10 Selected Single-Row Functions Oracle 10g: SQL
Chapter Nine Data Manipulation Language (DML) Functions
SQL 101 3rd Session.
Using Single-Row Functions to Customize Output
SQL 101 2nd Session.
Single-Row Functions Lecture 9.
Index Note: A bolded number or letter refers to an entire lesson or appendix. A Adding Data Through a View ADD_MONTHS Function 03-22, 03-23,
Lecture 5 SQL FUNCTIONS.
Presentation transcript:

Introduction to Oracle9i: SQL1 Selected Single-Row Functions

Introduction to Oracle9i: SQL2 Chapter Objectives Use the UPPER, LOWER, and INITCAP functions to change the case of field values and character strings Extract a substring using the SUBSTR function Determine the length of a character string using the LENGTH function

Introduction to Oracle9i: SQL3 Chapter Objectives Use the LPAD and RPAD functions to pad a string to a desired width Use the LTRIM and RTRIM functions to remove specific characters strings Round and truncate numeric data using the ROUND and TRUNC functions Calculate the number of months between two dates using the MONTHS_BETWEEN function

Introduction to Oracle9i: SQL4 Chapter Objectives Identify and correct problems associated with calculations involving null values using the NVL function Display dates and numbers in a specific format with the TO_CHAR function Determine the current date setting using the SYSDATE keyword Nest functions inside other functions Identify when to use the DUAL table

Introduction to Oracle9i: SQL5 Terminology Function – predefined block of code that accepts arguments Single-row Function – returns one row of results for each record processed Multiple-row Function – returns one result per group of data processed

Introduction to Oracle9i: SQL6 Types of Functions

Introduction to Oracle9i: SQL7 Case Conversion Functions Alter the case of data stored in a column or character string

Introduction to Oracle9i: SQL8 LOWER Function Used to convert characters to lower-case letters

Introduction to Oracle9i: SQL9 UPPER Function Used to convert characters to upper-case letters

Introduction to Oracle9i: SQL10 INITCAP Function Used to convert characters to mixed-case

Introduction to Oracle9i: SQL11 Character Manipulation Functions Manipulates data by extracting substrings, counting number of characters, replacing strings, etc.

Introduction to Oracle9i: SQL12 SUBSTR Function Used to return a substring, or portion of a string

Introduction to Oracle9i: SQL13 LENGTH Function Used to determine the number of characters in a string

Introduction to Oracle9i: SQL14 LPAD and RPAD Functions Used to pad, or fill in, a character string to a fixed width

Introduction to Oracle9i: SQL15 LTRIM and RTRIM Functions Used to remove a specific string of characters

Introduction to Oracle9i: SQL16 REPLACE Function Substitutes a string with another specified string

Introduction to Oracle9i: SQL17 CONCAT Function Used to concatenate two character strings

Introduction to Oracle9i: SQL18 Number Functions Allows for manipulation of numeric data

Introduction to Oracle9i: SQL19 ROUND Function Used to round numeric columns to a stated precision

Introduction to Oracle9i: SQL20 TRUNC Function Used to truncate a numeric value to a specific position

Introduction to Oracle9i: SQL21 Date Functions Used to perform date calculations or format date values

Introduction to Oracle9i: SQL22 MONTHS _ BETWEEN Function Determines the number of months between two dates

Introduction to Oracle9i: SQL23 ADD _ MONTHS Function Adds a specified number of months to a date

Introduction to Oracle9i: SQL24 NEXT _ DAY Function Determines the next occurrence of a specified day of the week after a given date

Introduction to Oracle9i: SQL25 TO _ DATE Function Converts various date formats to the internal format (DD-MON-YYYY) used by Oracle9i

Introduction to Oracle9i: SQL26 Format Model Elements - Dates

Introduction to Oracle9i: SQL27 NVL Function Substitutes a value for a NULL value

Introduction to Oracle9i: SQL28 NVL2 Function Allows different actions based on whether a value is NULL

Introduction to Oracle9i: SQL29 TO_CHAR Function// Converts dates and numbers to a formatted character string

Introduction to Oracle9i: SQL30 Format Model Elements – Time and Number

Introduction to Oracle9i: SQL31 Other Functions NVL NVL2 TO_CHAR DECODE SOUNDEX

Introduction to Oracle9i: SQL32 DECODE Function Determines action based upon values in a list

Introduction to Oracle9i: SQL33 SOUNDEX Function References phonetic representation of words

Introduction to Oracle9i: SQL34 Nesting Functions One function is used as an argument inside another function Must include all arguments for each function Inner function is resolved first, then outer function

Introduction to Oracle9i: SQL35 DUAL Table Dummy table Consists of one column and one row Can be used for table reference in the FROM clause