Documente Academic
Documente Profesional
Documente Cultură
ORACLE
Operating system requirements for Oracle Client Tools:Before installing Oracle Client tools, an appropriate operating system like Windows 95 or Window NT Workstation needs to be installed on the client computer. Oracle Client side tools, that come bundled in a tool kit called Developer 2000, comprises of:a. b. c. d. Oracle SQL*Plus Oracle Forms Designer Oracle Reports Designer Oracle Graphics.
Oracle SQL*Plus is a separate tool that comes as a part of Oracle Enterprise Server as well as Oracle Workgroup Server via which user can communicate interactively with the Oracle Server.
Client-Server Model
Clients HDD
ORACLE
DATA MANIPULATION IN DATA BASE MANAGEMENT SYSTEM All organizations need to collect, process and stored data for its human, financial, material needs. For example, an organization could store information for Payroll, Accounts Receivable and Payable, Sales Receivable and Forecast or Design and Manufacturing. Table/Entity:In a DBMS a group of similar information or data which is of interest to an organization is called an Entity. Entity information is stored in an object called Table. The table must have a unique name via which it can be referred to, after its creation. The Oracle engine can manipulate data stored in such an object, (i.e. a table) at very high speed. The Component Parts Of A Two Dimensional Matrix: Attributes/Columns/Fields:Each entity can have a number of characters. A client can have characteristics like name, address, telephone number, fax number, balance due etc. The characteristics of an entity are called Attributes. The values for the characteristics are called Attribute values. Tuple/Record/Row:An organization will deal with many clients and the same information must be recorded for each client. Multiple fields placed in a horizontal place, is called a Record or Row or Tuple.
Attributes Name Gaju aju Sanju Viju AccountNo A-101 A-102 A-104 A-105 Balance 3000 4000 5000 4000 Tuples
ORACLE
CHAR (Size):- This data type is used to store character strings values of fixed length. The size in brackets determines the number of characters the cell can hold. The maximum number of characters (i.e. the size) this data type can hold is 255 characters. ORACLE compares CHAR values using blank-padded comparison semantics i.e. if a value that is inserted in a cell of CHAR data type is shorter than the size it is defined for then it will be padded with spaces on the right until it reaches the size characters in length VARCHAR (Size)/ VARCHAR2 (Size):- This data type is used to store variable length alphanumeric data. The maximum this data type can hold is 2000 characters. One difference between this data type and CHAR data type is ORACLE compares VARCHAR values using nonpadded comparison semantics i.e. the inserted values will not be padded with spaces. NUMBER (P, S):- The NUMBER data type is used to stored numbers (fixed or floating point). Numbers of virtually any magnitude maybe stored up to 38 digits of precision. Numbers as large as 9.99 * 10 to the power of 124, i.e. 1 followed by 125 zeros can be stored. The precision, (P), determines the maximum length of the data, whereas the scale, (S), determines the number of places to the right of the decimal. If scale is omitted then the default is zero. If precision is omitted, values are stored with their original precision up to the maximum of 38 digits. DATE: - This data type is used to represent date and time. The standard format is DD-MON-YY as in 21-JUN-98. To enter dates other than the stranded format, use the appropriate functions. Date Time stores date in the 24-hour format. By default, the time in a date field is 12:00:00 am, if no time portion is specified. The default date for a date field is the first day of the current month. LONG: - This data type is used to store variable length character strings containing up to 2GB. LONG data can be used to store arrays of binary data in ASCII format. LONG values cannot be indexed, and the normal character functions such as SUBSTR cannot be applied to LONG values. ROW / LONG ROW: - The ROW / LONG ROW data types is used to store binary data, such as digitized picture or image. Data loaded into columns of these data types are stored without any further conversion. ROW data type can have a maximum length of 255 bytes. LONG ROW data type can contain up to 2GB. Values stored in columns having LONG ROW data type cannot be indexed.
ORACLE
TWO DIMENSION MATRIX CREATION One needs to communicate with the Oracle engine to create a two dimensional matrix (i.e. a table) for the storage and manipulation of data. This must be done using the natural language of the Oracle Engine i.e. SQL. By using an SQL sentence we can command the engine to create a table with cell parameters of our choice. Hence, it is necessary to understand how to construct standard SQL sentences. A look at a generic SQL sentence will help understand SQL syntax. The Generic SQL Sentence Construct:[Clause 1]<para1:1 para1:2 para1:n>, [Clause 2]<para2:1 para2:2 para2:n>,..[clause n]; The rules of (grammar) SQL syntax: An SQL statement starts with a verb. This verb may have additional nouns and adjectives. Each verb is followed by a number of clauses. Each clause has one or more parameters. Beyond this no further decomposition is allowed i.e. parameters cannot in turn have subparameters. A space separates clause within an SQL statements. A comma separates parameters within a clause. A semi colon is used to terminate the SQL statement.
ORACLE
CREATE TABLE client (Client_no varchar(6), Name varchar2(20), City varchar2(30), Balance number(10,2));
Syntax:
ORACLE
Example: 1. insert the following values into the client table. Column name Client_no Name City Balence values C0200 Gajendra Nanded 40000
INSERT INTO client(Client_no, Name, City, Balance) VALUES(C0200,Gajendra,Nanded,40000); In the insert into SQL sentence the columns and values have a one to one relationship i.e. the first value described into the first column, the second values described being inserted into the second column and so on.
ORACLE
The Oracle Server compiles the sentence, executes it, and retrieves data for all columns/rows from the table. Filtering Table Data : The ways of filtering data will be Selected columns and all row Selected rows and all columns Selected columns and selected rows
Selected Columns and All Rows: The retrieval of specifies columns from a table: Syntax: SELECT columnname, columnname from tablename; Example: 1.retrieve the contents of the columns client_no and name from the table client_master. SELECT client_no, name from client_master; Selected Rows and All columns: The SELECT statement used unit now displayed all rows. This is because there was no condition set that informed Oracle about the need to view a specific data set from the table. Oracle provides the option of using a where clause in an SQL sentence to apply a filter on the rows the select statement will retrieve. When a where clause is added to the SQL sentence, the Oracle Server compares each record from the table with the condition specified in the where clause. Oracle displays only those records that satisfy the specified condition. Syntax: SELECT * FROM tablename WHERE search condition;
ORACLE
Example: 1. retrieve all client_information from the table client_master where the value in the bal_due field is greater than 0; SELECT * FROM client_master WHERE bal_due>0; Selected Columns and Selected Rows: To view a specific data set from the table and also a select number of columns the syntax will be: Syntax: SELECT columnname, columnname FROM tablename WHERE search condition; Example: Retrieve the client_no, name from the table client_master where the value in the bal_due field is greater than 5000; Syntax: SELECT client_no, name FROM client_master WHERE bal_due>5000; Elimination of duplicates from the Select statement: A table could hold duplicate rows. In such a case, to see only unique rows the syntax is: Syntax: SELECT DISTINCT columnname, columnname FROM tablename; The SELECTE DESTICT SQL syntax scans through the values of the column/s specified and displays unique values from amongst them. Syntax: SELECT DISTICT * FROM tablename; 1. Select only unique rows from the table client_master. Syntax: SELECT DISTINCT * FROM client_master;
ORACLE
Sorting data in a table: Oracle allows data from a table to be viewed in a sorted order. The rows retrieved from the table will be sorted in either ascending or descending order depending on the condition specified in the select sentence. The syntax for viewing data in a sorted order is: Syntax: SELECT * FROM tablename ORDER BY columnname, columnname[sort order]; Example: 1. Retrieve all rows from the table client_master and display this data sorted on the value contained in the field client_no in ascending order. SELECT * FROM client_master ORDER BY client_no; For viewing the data in descending sorted order the word desc must be mentioned after the column name and before the semicolon in the order by clause. In case there is no mention of the sort order, the Oracle engine sorts in ascending order by default. Example: SELECT client_no, name, address1, address2, city, pincode FROM client_master ORDER BY client_no desc;
10
Removal of All Rows: Syntax: DELETE FROM tablename; Example: 1. Delete all rows from the table client_master. DELEDTE FROM client_master; Removal of a Specified Row/s: Syntax: DELETE FROM tablename WHERE search condition; Example: 2. Delete rows from the table client_master where where the value in the bal_dul field is less than 5000. DELETE FROM client_master WHERE bal_due<500;
DESTROYING TABLES:
Syntax: DROP TABLE tablename; Example: 1. Destroy the table client_master and all the data held in it. DROP TABLE client_master;
11
Updating of All Rows: Syntax: UPDATE tablename SET columnname=expression, columnname=expression; Example: 1. Given every employee a bonus of 15%. Calculate the 15% amount based on the value held in the column basic_sal of the table emp_master and update the values held in the column net_sal. UPDATE emp_master SET netsal=net_sal+basic_sal*0.15; Updating records conditionally: Syntax: UPDATE tablename SET columnname =expression, columnname=expression . WHERE columnname=expression; Example: 2. Update the client_master change the contents of the field name to Gajendra and the contents of the field address to Nanded for the record identified by the field client_no containing the value C0200. UPDATE client_master SET name = Gajendra, address = Nanded WHERE client_no = C0200;
12
ORACLE
13
14