This action might not be possible to undo. Are you sure you want to continue?
PROJECT FILE OF ORACLE
Supervised by: Prof. Akshay Kumar Sharma
Oracle and SQL
This term assistance, department completing particularly
paper has been written with the kind guidance and active support of my teachers who have helped me a lot in this paper. I express my deep regards to my esteem guide and supervisor Prof. Akshay Kumar Sharma for his valuable advice and support to complete this work.
I appreciate the concern shown by Prof. Sharma. Who guided me from time to time in giving final shape to this paper. Last but not least I am thankful to my parents and who helped me lot in preparing this paper.
PERTICULARS PAGE NO.NO. 1. REMAKS  .Oracle and SQL INDEX S.
Oracle and SQL  .
Oracle and SQL ORACLE  .
Oracle and SQL INTRODUCTION OF ORACLE Oracle is currently one of the most widely used RDBMS that provides efficient solutions for the database applications. high performance business intelligent services etc. Slovak. German. mobile computing. Portuguese. Chinese. The Oracle RDBMS stores data logically in the form of table spaces and physically in the form of data files.. who had a cat named Tiger. Hebrew. English. The name of the SCOTT schema originated with Bruce Scott. Greek.  . Oracle is supported over different operating environments ranging from IBM mainframes. Oracle Corporation provides database developers with tools and mechanisms for producing internationalized database applications: referred to internally as "Globalization". manufacturing. Most Oracle database installations traditionally came with a default schema called SCOTT.M. java. oracle also provides open access to web servers through SQL. Millions of application developers and database administrators around the world use oracle to built complex system that manage huge amount of data. UNIX based mini computers. Spanish. DEC. human resources. Romanian. VAX minicomputers etc. Japanese. Oracle consists of multitude of powerful features and components which makes it different from other rdbms. It include ecommerce. Hungarian. time-symbols such as A. Italian. Korean. Oracle Corporation has translated Oracle Database error-messages into Arabic. Polish.D. Finnish. standard web interfaces. abbreviations. Danish. French. Windows NT. Catalan. Czech. Swedish. Russian. and sorting. strategic enterprise management. and A. Thai and Turkish. The Oracle Database is an object-relational database management system produced and marketed by Oracle Corporation. Oracle Database software comes in 63 language-versions. Variations between versions cover the names of days and months. It is responsible for accurately storing the data and efficiently retrieving that data in response to a user query. Oracle provides a wide range of softwares designed for today’s business that moves at speed of internet. the user can log into the database with the username Scott and the password tiger. Norwegian. Dutch. After the installation process has set up the sample tables. one of the first employees at Oracle (then Software Development Laboratories).
Most popular commercial and open source databases currently in use are based on the relational database model. SDL developed the original version of the Oracle software. Codd. HOW IT WAS GENERATED Larry Ellison and his friends and former co-workers Bob Miner and Ed Oates started the consultancy Software Development Laboratories (SDL) in 1977. The name Oracle comes from the code-name of a CIA-funded project Ellison had worked on while previously employed by Ampex HEAD  . F. A relational database management system (RDBMS) is a database management system (DBMS) that is based on the relational model as introduced by E.Oracle and SQL FULL FORM The Oracle Database is commonly referred to as Oracle RDBMS or simply as Oracle. A short definition of an RDBMS may be a DBMS in which data is stored in the form of tables and the relationship among the data is also stored in the form of tables.
In late 1970’s Lawrence Joseph Ellison and Robert n minor were working on consulting project for the CIA in USA where CIA wanted to use SQL. Oracle Grid Computing. and in the data centers of 100 of the Fortune Global 100 companies. Oracle and Sun introduced the Sun Oracle Database Machine. application development. support for enterprise Linux. the oracle corporation was named as Relational Software Inc. but then word English later being dropped in favor of STRUCTURED QUERY LANGUAGE. the world's fastest machine for any type of database workload. Sun Oracle Real Application Clusters. sponsored by IBM. the most salient result of this research project was the development of SQL. Oracle Applications. business applications. in 1977. and decision support tools. Dr. The purpose of this project was to validate the feasibility of the rational model and to implement a DBMS based on this model. SQL originated with the system R project in 1974 at IBM’s San Jose Research Center.  . Today. then came to accepted as the definitive model for Relational Database Management System. Oracle is the first software company to develop and deploy 100 percent internet-enabled enterprise software across its entire product line: database. E. This relational model. But later to avoid confusion with competitor RTI.F. In addition to contributing to the concept of query complication and optimization and concurrency controlled mechanisms. Now more than ever before Oracle technology can be found in nearly every industry.Oracle and SQL HISTORY OF ORACLE In June 1970. Before the acquisition of Sun was final. Initially. The language developed by IBM to manipulate the data stored with in Codd’s model as originally called Structured English Query Language. A large number of commercial relational DBMS products were released from IBM as a conclusion of system R project. The code name for the project was ORACLE. Codd published a paper entitled A Relationship Model of data for large shared data banks. Today Oracle is the gold standard for database technology and applications in enterprises throughout the world—the company is the world's leading supplier of information management software and the world's second largest independent software company. all fuel a commitment to innovation and results that has defined Oracle for thirty years. The acquisition of Sun gives Oracle a leadership role in the hardware arena as well. the company’s name RSI was changed to Oracle Corporation. and Oracle Fusion.
Oracle and SQL FEATURES OF ORACLE 1)Client/server environment : Oracle allows processing to be split between the client application programs and the database server. the bulk of database processing is done on the backend i.e. 2)Scalability: Oracle supports a large numbers of concurrent users executing different types of application operating on the same data. maintenance of database. •Password expiration and forced password changes. Operations such as partial computer system failures and database backup failures do not interrupt the availability of data to the users. •Complex password enforcement that forces users to choose passwords which cannot be easily guessed by potential intruders. database server that typically has more computing power and better access to data to enhance the processing capabilities. It allows full control of space to make efficient use of expensive hardware devices. tuning. It provides the security by: •Account disablement after a specified number of failed attempts. 6)Security: Oracle provides safe-security features to protect database access against unauthorized use from the intruders. 3)Handles large databases and performs space management: Oracle provides support for handling large amount of data stored in database. 7)Database enforced integrity: oracle enforces data integrity by providing the integrity constraints thus restricting users from entering the data which do not validate the rules of integrity constraints. 4)High performance: Oracle maintains high degree of overall system performance by implementing database task in parallel with speed up querying. 5)Availability: Oracle provides high availability of data. It helps to add or remove users without interrupting the other users.  . •Password history maintenance to prevent users from reusing previous passwords.
Oracle forms: it is an enterprise tool used to develop data entry forms and menus that access tables in an oracle’s database. reports. •EXPORT/IMPORT: Command line utilities that allows a user or DBA to export data from an ORACLE database into a machine readable file to an Oracle database.  . • DEVELOPER/2000: It is a family of tools the supports the development client/server applications. Fortran.e. libraries routines and utilities that can be linked with C. C++. •DESIGNER/2000: It is a family of tools that support the development of complex applications that may span many organizations with in an enterprise •PROGRAMMER/2000: it includes the PRO* precompliers i. Oracle reports: It is a report writer tool used to develop reports that access tables in a oracle database. 2) DATABASE UTILITIES • ENTERPRISE MANAGER: A GUI based collection of utilities for managing Oracle database. java. it is named as ISQL *PLUS. operating systems. ORACLE PRODUCTS 1) APPLICATION DEVELOPMENT TOOLS: Following tools are used for the application development.Oracle and SQL 8)Openness industry standards: Oracle follows the industry accepted standards for the data access language network communication protocols. In oracle 9i. and graphics. • SQL* PLUS: A command line tool used to manipulate tables and other database objects in a oracle’s database. Oracle’s graphics: A graphical tool used to develop charts and presentation graphics from database queries. It includes forms. Cobol or other host languages to allow access to oracle’s database.
•ORACLE ODBC DRIVERS: Open database connectivity drivers for connecting software such as visual basic to oracle.Oracle and SQL •SQL* LOADER: A command line utility to load ASCII data files into an Oracle database. •SQL* DBA and SVRMGR: A utility that allows a DBA to monitor database activity and to tune the database for optimal performance. 3) MIDDLEWARE AND CONNECTIVITY PRODUCTS • SQL* NET: A communication driver that allows an Oracle tool running on an client machine to access data on a separate server machine.  .
Oracle and SQL Structured Query Language  .
• Administering the database • Formatting. A command may be continued over several lines and is stored in a buffer until it is overwritten. • Creating script files to store SQL statements for future use. show the definition of a table. Type the commands as indicated to see their effects. edit commands etc. They can optionally be terminated by a semicolon. The SQL*Plus run command lists then runs the command in the default buffer. It introduces SQL*Plus by giving examples of commands. Using it its users can connect to database. either on a same machine or a database located on a different server machine across a network. • Listing tables and PL/SQL object in the database. they have been included to illustrate the power of SQL.standard SQL commands and commands specific to SQL*Plus. The command is executed when a terminating semicolon is typed. SQL*PLUS performs the following task along with manipulation of SQL commands and PL/SQL blocks. printing query results in the form of reports • Copy data between databases. This document is designed to be used while logged on to a computer system which runs ORACLE or while using a PC with ORACLE. It can be terminated without executing it by entering a blank line. SQL*Plus prompts for the second and subsequent lines of the SQL command by displaying the current line number. SQL commands SQL commands are used to create. query and maintain a database.Oracle and SQL STRUCTURED QUERY LANGUAGE The SQL*Plus module of the ORACLE database management system is used to create. a / (slash) executes the SQL command without listing it. The examples are also available as files which can be used as described later. SQL*Plus commands SQL*Plus commands are used to control the way results are displayed. There are two types of command in SQL*Plus .  . The default buffer can contain only a single SQL command. calculations. Some of the examples are complex. They are one line long only. modify and query databases and to produce simple reports from them.
Oracle and SQL HOW TO START  .
and drop schema objects Grant and revoke privileges and roles Analyze information on a table.Oracle and SQL LANGUAGES Data Definition Language (DDL) Statements Data definition language (DDL) statements let you to perform these tasks • • • • • Create. or cluster Establish auditing options Add comments to the data dictionary  . alter. index.
and DROP commands require exclusive access to the specified object. This command specifies the name of table. TABLE MERGE. To create the table in your schema. are supported in PL/SQL. •Data Control Language DCL is a computer language and a subset of SQL. except certain forms of the COMMIT and ROLLBACK commands. The CALL and EXPLAIN PLAN statements are supported in PL/SQL only when executed dynamically. used to control access to data in a database. The transaction control statements are: COMMIT.USAGE.  .Oracle and SQL The CREATE. • Transaction Control Statements Transaction control statements manage changes made by DML statements. For information on the restrictions. In Oracle. name of columns in table as well as the data type and if required constraints associated with each column of table. although it can operate on the accessed data before returning the results of the query.INSERT. SELECT. For example. an ALTER TABLE statement fails if another user has an open transaction on the specified table. EXPLAIN PLAN. executing a DCL command issues an implicit commit. SELECT UPDATE. It cannot manipulate data in the database. SET TRANSACTION.UPDATE. Examples of DCL commands include: GRANT. ROLLBACK. Tables are created using CREATE TABLE command which is one of the important DDL statement. REVOKE. All other DML statements are fully supported in PL/SQL.CREATE: In order to store and manage the data it is necessary to create tables. These statements do not implicitly commit the current transaction. SAVEPOINT. DDL STATEMENTS 1. and can be rolled back. •Data Manipulation Language (DML) Statements •Data manipulation language (DML) statements access and manipulate data in existing schema objects. see COMMIT and ROLLBACK . The SELECT statement is a limited form of DML statement in that it can only access data in the database. The data manipulation language statements are: CALL. ALTER.DELETE. you must have the CREATE TABLE system privilege. executing DCL is transactional. You must have CREATE ANY TABLE system privilege. To create table in another user’s schema.EXECUTE. In Oracle. All transaction control statements. INSERT LOCK. In PostgreSQL. DELETE. CONNECT.
SYNTAX  . It can be done by using DROP TABLE command.……. 2. All the table rows. The DROP TABLE command removes the table from the database. If cascade constraint is not specified and user attempts to drop a table that has records in child table. <colomn_name2><data_type>[DEFAULT<expression>][<column constraints>]] [. <colomn_namen><data_type>[DEFAULT<expression>][<column constraints>]] [. (for dropping multiple tables) 3. <table constraints>] ).]<table_name> ( <colomn_name1><data_type>[DEFAULT<expression>][<column constraints>] [. The CASCADE CONSTRAINT is the optional parameter which is used for tables which have foreign keys that reference the table being dropped. indexes and privileges will also be removed. SYNTAX • ALTER TABLE<table name> DROP COLOMN <colomn name> (for dropping one colomn) • ALTERTABLE<tablename> DROP (<colomnname1>. any associated index with that constraint is also dropped.ALTER: You cannot only modify the columns that exist in your tables but you can also drop them entirely.Oracle and SQL SYNTAX CREATE TABLE [SCHEMA. When a constraint is dropped. You can also remove the constraints from the table using the ALTER TABLE statement. DROP Sometime it is necessary to remove table from database completely that is no longer needed. then error will occur. <colomnname2>).] [.
in data dictionary but it does not updates a store code module. table must be in your schema or you must have INSERT privilege on the table. OR RENAME<old_tablename> to <new_tablename>. null values etc. only. INSERT The INSERT statement is used to add new row to the table.  . Only one row is inserted at a time with this syntax. You can insert literal values. expressions containing operators and functions. To insert new row into the table.Oracle and SQL Drop Table<table name>[ CASCADE CONSTRAINTS]. stored queries or reports client applications. Oracle automatically updates foreign keys. STNTAX ALTER TABLE<old_tablename> RENAMETO<new_tablename>.RENAME Oracle provides the facility to change the name of table by using ALTER TABLE statement. DML STATEMENTS i. 4. When you rename the table. You can insert rows into table without specifying the column name because they are optional. So care must be taken when renaming the table.
It can update zero or more rows in table. the UPDATE statement is used. SYNTAX DELETE FROM<tablename> [WHERECONDITION] iii. You do not need to know the physical ordering of the rows in a table to perform a DELETE. so in order to make these changes. <colmnname2>]……[.<colomnnameN>]). If such expression will not be provided then DELETE statement will remove all rows from table. <colmnname2>]……[. • At least one column must be assigned an expression in SET clause. Oracle database engine determines the internal location of rows. it must be in your own schema or you must have delete privilege on the table.Oracle and SQL SYNTAX INSERT INTO <tablename>[(<colmnname1>[. Zero or more rows can be removed from the table.<colomnnameN>])] VALUES (<colmnname1>[. UPDATE As it is required to make changes or modifications in the records of table. To update rows in table. A condition is used in the WHERE clause to filter the records that are actually being removed. To delete rows from table.  . • It can only reference a single table. With this statement the user can modify the existing data stored in table. ii. Following points should be remembered while executing UPDATE statement. it must be in your schema or you must have update privilege on table.DELETE The DELETE statement is used to remove the row from table.
Following are the different data types:1 CHARCTER DATA TYPE Character data types are used to declare columns containing character data in the database.  . iv. The columns are used for storing an attribute’s data. ORACLE DATA TYPES Oracle tables are used for storing data which consist of both rows and columns. all values stored in that column will also have the length as specified in the length of declaration.Oracle and SQL • On omitting. the update statement automatically updates all the records of the table on execution. Once a ‘char’ column is defined. Each column in a table has a column name and a data type. Following are the different character data type: o CHAR (n): This data type is used for storing fixed length character strings. • Multiple conditions should be given in where clause.
It is store in specified internal oracle format that includes not only the month. It is mostly used to store long text strings. day and year but also the hours. positive and negative fixed and floating point numbers.  . graphics. documents etc. The precision is the total number of digits in the number and can range from 1 to 38digits. The scale describes the number of digits to right of decimal point in any given number. o NCHAR (n): This data type is used to store fixed length national character set. o VARCHAR2 (n): This data type is used to store variable length character string. o NUMBER: This data type is used to store zero. o RAW and LONGRAW: They both are used to store binary data such as sound. o DATE: this data type is used to store data and time information. 3 DATE/TIME DATA TYPE It stores data and time information. Its syntax is TIMESTAMP [(fract_second_precision)]. minutes and seconds. o LONG (n): This data type is used to store a large amount of variable length character strings. you must specify its size. o NVARCHAR2 (n): This data type is used to store variable-length string in database national character set. floating point numbers and real numbers. The NUMBER data types offer great flexibility for storing numeric data. in order to store data in language and characters set other than English. The NUMBER data type have a precision and a scale.Oracle and SQL o VARCHAR (n): This data type is used to store variable length character strings. It allows time to be stored as date with fractional seconds. but oracle recommends using VARCHAR2 (n) data type instead of VARCHAR (n) data type. o TIME STAMP: it is an extension of the date data type. When declaring a column of data type VARCHAR2. When you create a table with it you define the column length either in characters or in bytes. 2 NUMBER DATA TYPES The NUMBER data types are used for storing numeric data such as integers. This character set enables developers and administrators to extend the standard database character set.
The operators are represented by special characters and keywords. For example: the addition operator is represented by plus sign and operator that test for nulls is represented by IS NULL. 4 LOB’S The large objects provide a more flexible storage mechanism for large amount of binary and character based data such as text. minutes and seconds. o INTERVAL DAY TO SECOND: it allows time to be stored as an interval of days to hours. The data items on which operators act upon are called operands. image video. o BLOB: The binary large object data type is used to store binary data such as images. sound etc. audio files. o BFILE: the binary file data type when declared for a column contains pointers to large binary files stored on the file system of the data base server. It is used in place of VARCHAR2 column to store text in applications when the size of data is 4000 characters. 1) ARITHMATIC OPERATORS  . Some operators require two operand while other act upon only one operand. video etc. Its syntax: INTERVALYEAR [(year_percision)]TO MONTH.Oracle and SQL o INTERVAL YEAR TO MONTH: it allows time to be stored as an interval of years and month. The operators which act upon one operand are called unary operators and operators that act upon two operand are called binary operators. o CLOB: The character large object data type is used for storing large amount of character data. OPERATORS An operator manipulates individual data item and returns a result.
IN: to check whether the value is equal to any member of set.+ and – operators are also used in date arithmetic. BETWEEN: to test whether the value is within the range or not. The result for such comparison can be TRUE. /: Divides two operands. LIKE: used in character string comparisons with pattern matching. In other words. ANY: compares a value to each value in the list on being returned by a query. a logical operator combines the result of two component conditions to produce a single result based on them or to invert the result of single condition. Returns FALSE if either is FALSE otherwise return UNKNOWN. -: donates a negative expression when used as unary expression *: Multiplies two operands. AND: if the both logical expression evaluates to be TRUE. <=: if(expr 1<= expr 2) then the less than equal to comparison operator results TRUE if expr 1 is less than equal to expr 2.g. otherwise false. ISNULL: it checks whether the value of a specified column is NULL or not. Returns FALSE if either is FALSE otherwise return UNKNOWN. >: if (expr 1> expr 2) then the greater than comparison operator results TRUE if expr 1 is greater than expr 2. 10/5 2) COMPARISON OPERATORS These are used to compare one expression with other. OR: if either logical expression evaluates to be TRUE. negative.g. ALL: compares a value to every value in the list on being returned by a query. E. then the result is TRUE. otherwise false <: if (expr 1<expr 2) then the less than comparison operator results TRUE if expr 1 is less than expr 2.g. multiply. It is a binary operator e.  . 3) LOGICAL OPERATORS These are used to combine the individual logical expressions into more complex conditions that are either TRUE or FALSE. or UNKNOWN. 6*5 is a Binary operator. EXISTS: it returns TRUE if sub query returns at least one row. +: donates the positive expression when used as unary operators. then the result is TRUE. divide numeric values. E. subtract. Result of operation is also a numeric value. FALSE. + 5 add two operands when used as binary operators.Oracle and SQL These operators are used in an expression to add. otherwise false >=: if(expr 1>= expr 2) then the greater than equal to comparison operator results TRUE if expr 1 is greater than equal to expr 2. otherwise false.
UNIONALL: It returns all rows selected by either query including all duplicates.Oracle and SQL NOT: it is urinary operators which return TRUE.  . PRIOR used in tree structure queries. Returns FALSE if either is FALSE otherwise return UNKNOWN. 5) SET OPERATORS These operators combine the result of two component queries into single result. 6) Other in-built operators Some other in built operators include(+) which used in outer join operators. UNION: It returns all rows selected by either query excluding all duplicates. if the condition is FALSE. 4) CONCATENATION OPERATORS (ii) The concatenation operator is used to concatenate two or more strings. MINUS: It returns all distinct rows selected by the first query but not the second. INTERSECT: It returns all distinct rows selected by both queries.