sql oracle 1. data type 2 3 varchar2(size [byte | char]) variable-length character string having...

12
SQL ORACLE 1

Upload: cecil-armstrong

Post on 14-Jan-2016

239 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: SQL ORACLE 1. Data Type 2 3 VARCHAR2(size [BYTE | CHAR]) Variable-length character string having maximum length size bytes or characters. Maximum size

SQL ORACLE

1

Page 2: SQL ORACLE 1. Data Type 2 3 VARCHAR2(size [BYTE | CHAR]) Variable-length character string having maximum length size bytes or characters. Maximum size

Data Type

2

Page 3: SQL ORACLE 1. Data Type 2 3 VARCHAR2(size [BYTE | CHAR]) Variable-length character string having maximum length size bytes or characters. Maximum size

3

Page 4: SQL ORACLE 1. Data Type 2 3 VARCHAR2(size [BYTE | CHAR]) Variable-length character string having maximum length size bytes or characters. Maximum size

VARCHAR2(size [BYTE | CHAR]) Variable-length character string having maximum length size bytes or characters. Maximum size is 4000 bytes or characters, and minimum is 1 byte or 1 character. You must specify size for VARCHAR2.BYTE indicates that the column will have byte length semantics. CHAR indicates that the column will have character semanticsCHAR [(size [BYTE | CHAR])] Fixed-length character data of length size bytes or characters. Maximum size is 2000 bytes or characters. Default and minimum size is 1 byte.

4

Page 5: SQL ORACLE 1. Data Type 2 3 VARCHAR2(size [BYTE | CHAR]) Variable-length character string having maximum length size bytes or characters. Maximum size

NUMBER [ (p [, s]) ] Number having precision p and scale s. The precision p can range from 1 to 38. The scale s can range from -84 to 127. Both precision and scale are in decimal digits. A NUMBER value requires from 1 to 22 bytes.

5

Page 6: SQL ORACLE 1. Data Type 2 3 VARCHAR2(size [BYTE | CHAR]) Variable-length character string having maximum length size bytes or characters. Maximum size

LONG Character data of variable length up to 2 gigabytes, or 231 -1 bytes. Provided for backward compatibility.RAW(size) Raw binary data of length size bytes. Maximum size is 2000 bytes. You must specify size for a RAW value.

6

Page 7: SQL ORACLE 1. Data Type 2 3 VARCHAR2(size [BYTE | CHAR]) Variable-length character string having maximum length size bytes or characters. Maximum size

DATE Valid date range from January 1, 4712 BC, to December 31, 9999 AD. The default format is determined explicitly by the NLS_DATE_FORMAT parameter or implicitly by the NLS_TERRITORY parameter. The size is fixed at 7 bytes. This data type contains the date time fields YEAR, MONTH, DAY, HOUR, MINUTE, and SECOND. It does not have fractional seconds or a time zone.

7

Page 8: SQL ORACLE 1. Data Type 2 3 VARCHAR2(size [BYTE | CHAR]) Variable-length character string having maximum length size bytes or characters. Maximum size

8

Page 9: SQL ORACLE 1. Data Type 2 3 VARCHAR2(size [BYTE | CHAR]) Variable-length character string having maximum length size bytes or characters. Maximum size

9

Page 10: SQL ORACLE 1. Data Type 2 3 VARCHAR2(size [BYTE | CHAR]) Variable-length character string having maximum length size bytes or characters. Maximum size

Key structure

• SELECT select_list[ INTO new_table ] FROM table_source [ WHERE search_condition ] [ GROUP BY group_by_expression ] [ HAVING search_condition ] [ ORDER BY order_expression [ ASC | DESC ] ]

10

Page 11: SQL ORACLE 1. Data Type 2 3 VARCHAR2(size [BYTE | CHAR]) Variable-length character string having maximum length size bytes or characters. Maximum size

Grammar• SELECT statement ::=

< query_expression > [ ORDER BY { order_by_expression | column_position [ ASC | DESC ] } [ ,...n ] ] [ COMPUTE { { AVG | COUNT | MAX | MIN | SUM } ( expression ) } [ ,...n ] [ BY expression [ ,...n ] ] ] [ FOR { BROWSE | XML { RAW | AUTO | EXPLICIT } [ , XMLDATA ] [ , ELEMENTS ] [ , BINARY base64 ] } ] [ OPTION ( < query_hint > [ ,...n ]) ]

11

Page 12: SQL ORACLE 1. Data Type 2 3 VARCHAR2(size [BYTE | CHAR]) Variable-length character string having maximum length size bytes or characters. Maximum size

Grammar-cont.• < query expression > ::=

{ < query specification > | ( < query expression > ) } [ UNION [ ALL ] < query specification | ( < query expression > ) [...n ] ]

• < query specification > ::= SELECT [ ALL | DISTINCT ] [ { TOP integer | TOP integer PERCENT } [ WITH TIES ] ] < select_list > [ INTO new_table ] [ FROM { < table_source > } [ ,...n ] ] [ WHERE < search_condition > ] [ GROUP BY [ ALL ] group_by_expression [ ,...n ] [ WITH { CUBE | ROLLUP } ] ] [HAVING <search_condition>]

12