Sie sind auf Seite 1von 14

BASIC QUESTIONS:

1.WHICH VERSION OF ORACLE ARE YOU USING?

 ANSWER: I am using 11G version.

2.WHAT IS THE MEANING OF I, g AND c IN ORACLE


VERSION?

 ANSWER: „i‟ stands for the INTERNET, „g‟ stands for GRID, ‟c‟ stands
for CLOUD.

3.WHAT IS SCHEMA IN ORACLE?

 Schema is logical structures created by users.


 Schema is a collection of database objects, including logical Structures such
as tables, views, sequences, stored procedures, synonyms, indexes, clusters
and database links.
 A schema is owned by a database user.
 A user and a schema have the same name.
 The CREATE USER command creates a user. It also automatically creates a
schema for that user.
 The CREATE SCHEMA does not create schema as it implies, it just allows
you to create multiple tables and views and perform multiple grants in your
own schema in a single transaction.

4.WHAT IS SCHEMA OJECTS?


 A schema object in an Oracle database is a structure that describes how a
database is stored(structure of database).
 It includes information on tables, clusters, indexes,views, database links,
functions and other important parts of a database.
 A schema object is associated with aeach database user and is stored I table
space of a database.
 Schema objects can be created and manipulated with SQL.

5.WHAT IS DUAL TABLE IN ORACLE?

 The DUAL table is a special one-row, one-column table present by default


in oracle and other database installations.
 It‟s used for selecting data from system functions and calculations when you
don‟t need any data from the database.
 The owner of DUAL is SYS. SYS owns the data dictionary , therefore
DUAL is the part of the data dictionary.
 DUAL is accesed by every user.
 In Oracle , the DUAL table has a single VARCHAR2(1) column and
DUMMY that has a value of „X‟.

6.WHAT ARE ALL SCHEMA OBJECTS AVAILABLE IN


ORACLE?

 Clusters
 Database links
 Database triggers
 Dimensions
 External procedure libraries
 Indexes and index types
 Java classes, Java resources, and Java sources
 Materialized views and materialized view logs
 Object tables, object types, and object views
 Operators
 Sequences
 Stored functions, procedures, and packages
 Synonyms
 Tables and index-organized tables
 Views

7.WHAT IS SQL?

 SQL (pronounced "ess-que-el") stands for Structured Query Language.


 SQL is used to communicate with a database or for accessing and
manipulating databases
 SQL became standard language for relational database management systems
by American National Standards Institute (ANSI) in 1986, and of the
International Organization for Standardization (ISO) in 1987
 SQL statements are used to perform tasks such as update data on a database,
or retrieve data from a database.
 Some common relational database management systems that use SQL are:
Oracle, Sybase, Microsoft SQL Server, Access, Ingres, etc.

8.WHAT IS DATA DICTIONARY TABLE IN ORACLE?

One of the most important parts of an Oracle database is its data dictionary,
which is a read-only set of tables that provides information about the database.

A data dictionary contains:

 The definitions of all schema objects in the database (tables, views, indexes,
clusters, synonyms, sequences, procedures, functions, packages, triggers,
and so on)
 How much space has been allocated for, and is currently used by, the
schema objects
 Default values for columns
 Integrity constraint information
 The names of Oracle users
 Privileges and roles each user has been granted
 Auditing information, such as who has accessed or updated various schema
objects
 Other general database information
The data dictionary is structured in tables and views, just like other database data.
All the data dictionary tables and views for a given database are stored in that
database's SYSTEM tablespace.

Not only is the data dictionary central to every Oracle database, it is an important
tool for all users, from end users to application designers and database
administrators.

Use SQL statements to access the data dictionary.

Because the data dictionary is read only, you can issue only queries (SELECT
statements) against it's tables and views.

9. HOW TO SELECT DATA FROM OTHER SCHEMA?

10.HOW TO SELECT UNIQUE RECORDS FROM THE


PARTICULAR COLUMN?

Select unique(column_name) from employees;

select unique(salary) from employees;

11.HOW TO SELECT DISTINCT RECORDS FROM THE


PARTICULAR COLUMN?

Select DISTINCT(column_name) from employees;

select distinct(salary) from employees;

12.HOW TO VIEW STRUCTURE OF THE TABLE?


DESC EMPLOYEES;

13.WHICH DATA DICTIONARY TABLE CONTAIN TABLE


INFORMATION?

User_tables : all tables with their name, number of columns,

storage information, statistical information etc.

select * from user_tables;

14.WHICH DATA DICTIONARY TABLE CONTAIN


INFORMATION ABOUT ALL THE OBJECTS IN DATABASE.

select * from USER_OBJECTS ;


RESTRICTION AND SORTING:
1.WHAT ARE ALL OPERATORS AVAILABLE IN ORACLE?

Arithmetic Operators:

Character Operators:

Comparison Operators

Comparison operators used in conditions that compare one expression with another
Logical Operators
Logical operators which manipulate the results of conditions
2.DIFFERENCE BETWEEN IN AND EXITS? WHICH ONE IS
MORE FASTER?WHY?

EXISTS is much faster than IN , when the sub-query results is very


large,theEXISTS operator provides a better performance. IN is faster than EXISTS ,
when the sub-query results is very small. The Exists keyword evaluates true or false,
but IN keyword compare all value in the corresponding sub query column.

3.WHICH OPERATOR IS USED FOR PATTERN MATCHING OR


TO DO WILD SEARCH?

“LIKE” operator is used for pattern matching.

“%”, “_” operator is used for wild card operator.

4.WRITE A QUERY TO DISPLAY ALL THE NAME WHICH


STARTS S :

select first_name from employees

where first_name like ('S%');

5. WRITE A QUERY TO DISPLAY ALL THE NAME WHICH


STARTS S AND ENDS WITH N:

select first_name from employees

where first_name like ('S%n');


6. WRITE A QUERY TO DISPLAY ALL THE EMPLOYEES
WHO ARE ALL WORKING FOR DEPARTMENT 90 AND
THEIR NAMR MUST STARTS WITH S

select first_name,department_id from employees

where department_id in(90)and first_name like('S%');

7.DIAPLAY ALL THE JOB ID WHICH CONTAIN _


(UNDERSCORE) AS 3 RD CHARACTER.

select first_name, job_id from employees

where job_id like ('___%');

8.WRITE A QUERY TO PRINT ALL THE FIRST _NAME WHICH


CONTAIN FIVE CHARACTERS;

SELECT FIRST_NAME FROM EMPLOYEES

WHERE LENGTH(FIRST_NAME) = 5;

9. WRITE A QUERY TO DISPLAY ALL THE EMPLOYEES WHO


ARE ALL WORKING IN DEPARTMENT 10,20,50 AND 90;

SELECT * FROM EMPLOYEES


WHERE DEPARTMENT_ID IN(10,20,50,90);

10. . WRITE A QUERY TO DISPLAY FIRST_NAME, SALARY


AND DEPARTMENT_ID OF THE EMPLOYEES WHO ARE ALL
NOT WORKING IN DEPARTMENT 10,20,50 AND 90;

SELECT * FROM EMPLOYEES

WHERE DEPARTMENT_ID NOT IN(10,20,50,90);

11.DISPLAY ALL THE EMPLOYEES WHO ARE ALL HIRED IN


YEAR 1994.

SELECT * FROM EMPLOYEES

WHERE HIRE_DATE LIKE('%94');

12. WRITE A QUERY TO DISPLAY WHO ARE ALL GETTING


SALARY BETWEEN 5000 AND 7000;

SELECT FIRST_NAME, SALARY FROM EMPLOYEES

WHERE SALARY BETWEEN 5000 AND 7000;


13.DISPLAY FIRST_NAME, SALARY, DEPARTMENT_ID AND
MANAGER_ID OF THE EMPLOYEE WHO DON’T HAVE
MANAGER :

SELECT FIRST_NAME, SALARY,DEPARTMENT_ID, MANAGER_ID FROM


EMPLOYEES

WHERE MANAGER_ID IS NULL;

14.DISPLAY ALL THE RECORD IN EMPLOYEES TABLE AND


SORT THE FIRST_NAME IN ASCENDING ORDER:

SELECT * FROM EMPLOYEES

ORDER BY FIRST_NAME ASC;

15.DISPLAY FIRST_NAME , DEPARTMENT_ID AND SALARY


FROM EMPLOYEES TABLE AND SORT THE RECORDS
(SORT DEPARTMENT_ID IN ASCENDING ORDER AND
SALARY IN DESCENDING ORDER.

SELECT FIRST_NAME,DEPARTMENT_ID,SALARY FROM EMPLOYEES

ORDER BY DEPARTMENT_ID,SALARY DESC;


16.WHAT IS THE DEFAULT ORDERING OF AN ORDER BY
CLAUSE IN A SELECT STATEMENT.

ASCENDING ORDER
FUNCTIONS
WHAT ARE THE TYPE OF FUNCTIONS AVAILABLE IN
ORACLE?

1.single row functions

Case function

Character function

Number function

Date function

General function

2.Multi row funcitons

DIFFERENCE BETWEEN SINGLE ROW FUNCTION AND MULTI


ROW FUNCTION?

LIST OUT ALL THE CASE AND CHARACTER FUNCTIONS.

DISPLAY FIRST THREE CHARACTERS FROM FIRST NAME.

DISPLAY LAST TWO CHARACTER FROM LAST NAME.

DISPLAY ALL THE FIRST NAME AND POSITION OF a IN THAT


NAME (FIRST OCCURANCE OF a).

DISPLAY ALL THE FIRST NAME AND POSITION OF a IN THAT


NAME (SECOND OCCURANCE OF a).

DISPLAY ALL THE NAME WHICH CONTAIN TWO OR MORE


NUMBER OF a’s in the FIRST NAME.

DIFFERENCE BETWEEN SUBSTR AND INSTR FUNCTION

DIFFERENCE BETWEEN REPLACE AND TRANSLATE


FUNCTION.
DIFFERENCE

Das könnte Ihnen auch gefallen