View stunning SlideShares in full-screen with the new iOS app!Introducing SlideShare for AndroidExplore all your favorite topics in the SlideShare appGet the SlideShare app to Save for Later — even offline
View stunning SlideShares in full-screen with the new Android app!View stunning SlideShares in full-screen with the new iOS app!
In Oracle, SQL statements are terminated with a semi-colon ;
By convention, uppercase SQL reserved words and lowercase data-specific words ( not mandatory ):
SELECT last_name FROM employees
WHERE employee_id = 197;
Object names are not case-sensitive, but string literals are:
SELECT employee_id FROM EMPLOYEES
WHERE last_name = ‘Smith’;
ORACLE DATATYPES Internal row address ROWID Pointer to an external file BFILE Large binary object, up to 4GB BLOB Large character string, up to 4GB CLOB A date and time DATE Floating point number with precision = p and scale = s NUMBER(p,s) Variable-length character string VARCHAR2(size) Fixed-length character string CHAR(size)
Likewise, when selecting a date from a table, you can display the date in different formats using the TO_CHAR function.
select TO_CHAR(SYSDATE, 'DD/MM/YY HH:MI:SS PM') as "current time" FROM DUAL
08/02/04 02:37:05 PM
DATE FORMAT ELEMENTS See Table 8-6 on page 224 of textbook for complete listing Seconds SS Military hour, i.e. 14:00 = 2pm HH24 Hour, 11 am and 11 pm are the same HH Minutes MI Show PM or AM for HH PM Two-digit year in 20 th century, i.e. 98 = 1998 RR Four-digit year – safest! YYYY Two-digit year – beware: 98 = 2098 YY Month spelled out, i.e. January MONTH Three-character month, i.e. JAN MON Two-digit month MM Day of week spelled out DAY Two-digit day DD Meaning Element