Download presentation
Presentation is loading. Please wait.
1
Introduction to Oracle
CSI 3317 (LAB 1) Introduction to Oracle
2
Introduction to Oracle……
In SITE Labs Programs Database apps Oracle – ORAHOME 92 Application Development SQL*PLUS
3
Introduction to Oracle……
4
Introduction to Oracle……
5
Introduction to Oracle……
Client / Server Database
6
Data Types VARCHAR2 CHAR Variable length character data
Max characters Field size must be specified on declaration If entered data is smaller than specified size only entered data is stored. Trailing blank spaces are omitted. CHAR Fixed length character data. Max. 255 characters. If no size specification – size only one character. If size specified and the data entered is smaller – trailing spaces added.
7
Data Types Continue…. NUMBER
Negative, Positive, fixed and floating point numbers. Range to 10126 Precision up to 38 decimal points. Integer Number e.g sid NUMBER(5) Can store up to 99,999 Fixed-Point Number e.g price NUMBER(5,2) Can store up to Floating-Point Number e.g gpa NUMBER Notice: No precision or scale Can store 2.7 as well as 3.725
8
Data Types Continued….. DATE
-From January 1, 4712 BC to December 31, 4712 AD -Stores Century Year Month Day Hour Minute Second -Default (DD-MON-YY) Use Mask to change. e.g dob DATE
9
Data Types Continued….. Other Data Types LONG RAW and LONG RAW
Up to 2GB Variable length character RAW and LONG RAW Binary data
10
RDBMS Remember your SQL operations
*Oracle is a hybrid of Relational and object oriented databases For Our LAB we will only touch Relational Properties Remember your SQL operations -create (to create a new object or table for our lab purpose) -select (view) -update (change) -insert
11
Oracle SQL*PLUS CREATE TABLE <table name>
To Create Table use CREATE TABLE <table name> ( <field name> <data type> CONSTRAINT, <field name> <data type> CONSTRAINT); To delete Table use DROPTABLE <table name>;
12
Oracle SQL*PLUS……. DROP TABLE location; CREATE TABLE LOCATION
(locid NUMBER(5) CONSTRAINT location_locid_pk PRIMARY KEY, bldg_code VARCHAR2(10) CONSTRAINT location_bldg_code_nn NOT NULL, room VARCHAR2(6) CONSTRAINT location_room_nn NOT NULL, capacity NUMBER(5) CONSTRAINT location_capacity_nn NOT NULL); Notice that the every constraint has a name.
13
Oracle SQL*PLUS……. To view the table specifications
DESCRIBE <table name>; To rename the table RENAME <oldtablename> <newtablename>; To add Additional Fields ALTER TABLE <table name> ADD <field name> <data declaration> <constraints>; To modify existing Fields MODIFY <field name> <new data declaration>;
14
Oracle SQL*PLUS……. Now lets populate the table
INSERT INTO location VALUES (53, 'BUS', '424', 1); INSERT INTO location VALUES (54, 'BUS', '402', 1); INSERT INTO location VALUES (45, 'CR', '101', 150);
15
Oracle SQL*PLUS……. Remember… we can we view this data with SELECT Statement. SELECT * from LOCATION;
16
Oracle Navigator Start Programs Database apps Oracle – ORAHOME 92 Application Development Oracle Navigator
17
Oracle Navigator …… Right-click on Database Connections New
Use the connection info similar to one used for SQL*PLUS introduction.
18
Oracle Navigator Click on Plus sign besides your Connection on left pane. Right-click on Table New Now use the wizard to create the same table. (Remember to Drop table before creating it again)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.