60 likes | 181 Views
This guide provides an in-depth overview of Oracle SQL data types, including character, binary, numeric, and date/time data types. Learn about essential functions for data manipulation such as SELECT, INSERT, DELETE, and UPDATE, along with data definition commands like CREATE TABLE and ALTER TABLE. Explore SQL operators—comparison, logical, and set operators—along with single-row and aggregate functions. Additionally, discover conversion functions for transforming data types and managing transactions. Equip yourself with the knowledge needed for effective Oracle SQL programming.
E N D
Oracle Data Types • Character Data Types: • Char(2) • Varchar (20) • Clob: large character string as long as 4GB • Bolb and bfile: large amount of binary file • Numeric Data Types: • Number: used to store real numbers • Binary float & binary double: to store data in a floating –point format • Date and Time Data Types: • Date: stores date & time • Timestamp: stores time values that are precise to fractional seconds • Conversion functions: • TO_CHAR: floating number to a string • TO_NUMBER: floating number or string to a number • TO_DATE: character data to a DATE data type • TO_TIMESTAMP:
SQL Statements • Data Manipulation: • SELECT • INSERT • DELETE • UPDATE • Data Definition: • CREATE TABLE • DROP TABLE • ALTER TABLE • CREATE VIEW • DROP VIEW • CREATE INDEX • DROP INDEX • CREATE SCHEME • DROP SCHEME • CREATE DOMAIN • DROP DOMAIN • Access Control: • GRANT • REVOKE
Transaction Control: • COMMIT: Ends the current transaction • ROLLBACK: Aborts the current transaction • SET TRANSACTION: Define the data access char. • Programmatic Control: • DECLARE • EXPLAIN • OPEN • FETCH • CLOSE • PREPARE • EXECUTE • DESCRIBE
Sql Operators • Comparison operator: • Between: tests whether a value is between a pair of value • IN: test whether a value is in a list of values • LIKE: Tests whether a value follows a certain pattern • Logical Operator: • AND, OR, NOT, GE, LE • The set Operator: • UNION: combines the result of more than one select statement after removing any duplicate rows • NUION ALL: • INTERSECTION: • MINUS: returns the rows returned by the first query that aren’t in the second query’s result.
SQL Functions • Single-Row Functions: • CONCAT: puts together two or more character strings into one string • LENGTH: length of character string • LOWER: uppercase letter to lower case • SUBSTR: part of string • INSTR: number indicating where in a string a certain string value starts. • REPLACE: • Aggregate Functions: • MIN • MAX • AVG • SUM • COUNT: total number of columns • COUNT(*) : number of rows in a table • Number & Date Functions: • ROUND • TRUNC • TO_DATE