Oracle-1
Oracle-1
14 marks
Q- Intrduction of oracle:
Q- what is table?
- Table is collection of raw and column.
Dbms Rdbms
Database management system Relational data base mangement
system.
In dbms relationship between two In rdbms relationship between two
table or file are maintain by program tables or file can create at the time of
table creation.
Dmbs does not support client and Rdbms support client and server
server model. moel
Dbms there is no security of data. In rdbms there are multi level of
security of data.
Each table given extension Many tables are in one data base.
Dbms satisfied less then 7 rules of It satisfied more then 7 reules of
dr.e.f codd rules dr.ef codd.
Q- explain relationship in detail.(3marks imp)
DETAILING:-
1) DDL :
DDL contains following commands or statements.
CREATE: It is used to create objects (table, view, function, procedure, trigger
etc) in the database.
ALETER: It is used to change the structure of database.
DROP: It is used to delete objects from the database.
TRUNCATE: It is used to remove all records from the table, including all
spaces allocated for the records are removed.
GRANT: It is used to give different command grant (access rights) to the user.
REVOKE: It is used to take the given grant back from the user.
2) DML:
DML contains following commands or statements.
INSERT: it used to insert the data into a table.
UPDATE: it used to update the existing data within a table.
DELETE: it used to delete all the records from the table, the space will be
remaining.
e CALL: it is used to call a PL/SQL program.
3) DCL:
e DCL contains following commands or statements.
e COMMIT: it is used to save the work.
e SAVEPOINT: it is used to identify a point in transaction.
e ROLLBACK: Restore database to original since the last commit (like undo).
4) DQL:
e DQL contain only one statement.
e SELECT: It is used to retrieve data from the database.
CHAR, VARCHAR,VARCAHR2,DATE,NUMBER,LONG,RAW
LONG DETAILING:-
2) VARCHAR:
Syntax: <column name> VARCHAR (<size>)
User can enter both character and numeric value if you specify column with
this data type.
It is variable length character string.
Example: name VARCHAR (10)
Now user can enter 10 alphanumeric digits into name column.
Maximum size of this data type is 2000 characters.
3) VARCHAR2:
6) LONG:
Syntax <column name> LONG
This data type is used to store variable length character strings containing up
to 2GB.
Only one long value can be defined per table.
Long values cannot be used in sub queries, functions, and expressions.
Example: image LONG
7) RAW/RAW LONG:
Syntax: <column name> RAW
<Column name> RAW LONG
This data type is used to store binary data, such as picture or images.
DETAILING:-
e SPOOL <filename>:
This allows saving SQL statements together with their outputs to a
file.
e SAVE <filename>: This allows you to save buffer contents into a file.
e DESCRIBE <table name>: Lists the attributes of tables and other objects.
The command also can be written as DESC <table name>.
e EDIT [filename]: Places you in an editor so you can edit a SQL command.
The command also can be written as ED [filename].
e EXIT or QUIT : Disconnect from the database and terminate SQL*Plus
e SET SERVEROUTPUT {OFF|ON}: Whether to display the output of
stored procedures (or PL/SQL blocks). By default OFF.
Ø SET COLSEP { |text} : The text to be printed between columns retrieved by SELECT
statement. Columns normally separated by a space.
ARITHMETIC OPERATOR
Comparison Operator:
Assume a = 10 and b = 20
Logical Operator:
Operator Description
AND This operator is used to provide multiple conditions in SQL
statements.
Both conditions must be true.
OR This operator is used to provide multiple Conditions in SQL
statements.
Either one or all condition may be true.
BETWEEN This operator is used to search values between max and minimum
values.
EXISTS This operator is used to search for the presence of a row in a
specified table.
LIKE This operator is used to compare a string value.
IN This operator is used to compare value from a given list.
IS NULL This operator is used to check the null value.
Negate operator:
Operator Description
NOT This operator reverses the meanings of the logical operator with
which it is used.
For ex. NOT EXISTS, NOT BETWEEN, NOT IN etc.