Oracle Sql Queries Asked In Interviews Pdf
Some frequently asked Oracle SQL Interview Questions for. Experienced on SQL Queries and Database.Oracle interview. Oracle interview questions pdf. Create a view on complex but frequently used queries so that users can access. To download oracle pl sql interview questions and answers for experienced pdf, Top 20 sql.
Difference between varchar and varchar2 data types? Varchar can store upto 2000 bytes and varchar2 can store upto 4000 bytes. Varchar will occupy space for NULL values and Varchar2 will not occupy any space. Both are differed with respect to space.
2. In which language Oracle has been developed? Oracle has been developed using C Language. What is RAW datatype?
RAW datatype is used to store values in binary data format. The maximum size for a raw in a table in 32767 bytes.
What is the use of NVL function? The NVL function is used to replace NULL values with another or given value. Example is – NVL(Value, replace value) 5.
Whether any commands are used for Months calculation? If so, What are they? In Oracle, monthsbetween function is used to find number of months between the given dates. Example is – Monthsbetween(Date 1, Date 2) 6. What are nested tables? Nested table is a data type in Oracle which is used to support columns containing multi valued attributes.
It also hold entire sub table. What is COALESCE function?
COALESCE function is used to return the value which is set to be not null in the list. If all values in the list are null, then the coalesce function will return NULL. Coalesce(value1, value2,value3,) 8. What is BLOB datatype?
A BLOB data type is a varying length binary string which is used to store two gigabytes memory. Length should be specified in Bytes for BLOB. How do we represent comments in Oracle? Comments in Oracle can be represented in two ways –. Two dashes(–) before beginning of the line – Single statement.
/.——./ is used to represent it as comments for block of statement 10. Data Manipulation Language (DML) is used to access and manipulate data in the existing objects.
DML statements are insert, select, update and delete and it won’t implicitly commit the current transaction. What is the difference between TRANSLATE and REPLACE? Translate is used for character by character substitution and Replace is used substitute a single character with a word. How do we display rows from the table without duplicates? Duplicate rows can be removed by using the keyword DISTINCT in the select statement. What is the usage of Merge Statement?
Merge statement is used to select rows from one or more data source for updating and insertion into a table or a view. It is used to combine multiple operations.
What is NULL value in oracle? NULL value represents missing or unknown data. This is used as a place holder or represented it in as default entry to indicate that there is no actual data present. What is USING Clause and give example? The USING clause is used to specify with the column to test for equality when two tables are joined. sqlSelect.
from employee join salary using employee ID/sql Employee tables join with the Salary tables with the Employee ID. What is key preserved table? A table is set to be key preserved table if every key of the table can also be the key of the result of the join. It guarantees to return only one copy of each row from the base table. What is WITH CHECK OPTION? The WITH CHECK option clause specifies check level to be done in DML statements. It is used to prevent changes to a view that would produce results that are not included in the sub query.
What is the use of Aggregate functions in Oracle? Aggregate function is a function where values of multiple rows or records are joined together to get a single value output. Common aggregate functions are –. Average. Count. Sum 19. What do you mean by GROUP BY Clause?
A GROUP BY clause can be used in select statement where it will collect data across multiple records and group the results by one or more columns. What is a sub query and what are the different types of subqueries? Sub Query is also called as Nested Query or Inner Query which is used to get data from multiple tables. A sub query is added in the where clause of the main query.
There are two different types of subqueries:. Correlated sub query A Correlated sub query cannot be as independent query but can reference column in a table listed in the from list of the outer query. Non-Correlated subquery This can be evaluated as if it were an independent query.
Results of the sub query are submitted to the main query or parent query. What is cross join? Cross join is defined as the Cartesian product of records from the tables present in the join. Cross join will produce result which combines each row from the first table with the each row from the second table. What are temporal data types in Oracle?
Oracle provides following temporal data types:. Date Data Type – Different formats of Dates. TimeStamp Data Type – Different formats of Time Stamp. Interval Data Type – Interval between dates and time 23. How do we create privileges in Oracle?
A privilege is nothing but right to execute an SQL query or to access another user object. Privilege can be given as system privilege or user privilege. sqlGRANT user1 TO user2 WITH MANAGER OPTION;/sql 24.
What is VArray? VArray is an oracle data type used to have columns containing multivalued attributes and it can hold bounded array of values.
How do we get field details of a table? Describe is used to get the field details of a specified table. What is the difference between rename and alias? Nichole Millard. Rename is a permanent name given to a table or a column whereas Alias is a temporary name given to a table or column. Rename is nothing but replacement of name and Alias is an alternate name of the table or column.
What is a View? View is a logical table which based on one or more tables or views. The tables upon which the view is based are called Base Tables and it doesn’t contain data. What is a cursor variable? A cursor variable is associated with different statements which can hold different values at run time. A cursor variable is a kind of reference type. What are cursor attributes?
Each cursor in Oracle has set of attributes which enables an application program to test the state of the cursor. The attributes can be used to check whether cursor is opened or closed, found or not found and also find row count. What are SET operators? SET operators are used with two or more queries and those operators are Union, Union All, Intersect and Minus.
How can we delete duplicate rows in a table? Duplicate rows in the table can be deleted by using ROWID. What are the attributes of Cursor? Attributes of Cursor are.%FOUND Returns NULL if cursor is open and fetch has not been executed Returns TRUE if the fetch of cursor is executed successfully. Returns False if no rows are returned.%NOT FOUND Returns NULL if cursor is open and fetch has not been executed Returns False if fetch has been executed Returns True if no row was returned.%ISOPEN Returns true if the cursor is open Returns false if the cursor is closed.%ROWCOUNT Returns the number of rows fetched.
It has to be iterated through entire cursor to give exact real count. Can we store pictures in the database and if so, how it can be done? Yes, we can store pictures in the database by Long Raw Data type. This datatype is used to store binary data for 2 gigabytes of length.
But the table can have only on Long Raw data type. What is an integrity constraint? An integrity constraint is a declaration defined a business rule for a table column. Integrity constraints are used to ensure accuracy and consistency of data in a database.
There are types – Domain Integrity, Referential Integrity and Domain Integrity. What is an ALERT?
An alert is a window which appears in the center of the screen overlaying a portion of the current display. What is hash cluster? Hash Cluster is a technique used to store the table for faster retrieval.
Apply hash value on the table to retrieve the rows from the table. What are the various constraints used in Oracle? Following are constraints used:. NULL – It is to indicate that particular column can contain NULL values. NOT NULL – It is to indicate that particular column cannot contain NULL values. CHECK – Validate that values in the given column to meet the specific criteria. DEFAULT – It is to indicate the value is assigned to default value 38.
What is difference between SUBSTR and INSTR? SUBSTR returns specific portion of a string and INSTR provides character position in which a pattern is found in a string. SUBSTR returns string whereas INSTR returns numeric. What is the parameter mode that can be passed to a procedure? IN, OUT and INOUT are the modes of parameters that can be passed to a procedure. What are the different Oracle Database objects? There are different data objects in Oracle –.
Tables – set of elements organized in vertical and horizontal. Views – Virtual table derived from one or more tables. Indexes – Performance tuning method for processing the records.
Synonyms – Alias name for tables. Sequences – Multiple users generate unique numbers. Tablespaces – Logical storage unit in Oracle 41. What are the differences between LOV and List Item? LOV is property whereas list items are considered as single item. List of items is set to be a collection of list of items.
A list item can have only one column, LOV can have one or more columns. What are privileges and Grants? Privileges are the rights to execute SQL statements – means Right to connect and connect. Grants are given to the object so that objects can be accessed accordingly. Grants can be provided by the owner or creator of an object. What is the difference between $ORACLEBASE and $ORACLEHOME? Oracle base is the main or root directory of an oracle whereas ORACLEHOME is located beneath base folder in which all oracle products reside.
What is the fastest query method to fetch data from the table? Row can be fetched from table by using ROWID. Using ROW ID is the fastest query method to fetch data from the table. What is the maximum number of triggers that can be applied to a single table?
Sql Queries Asked In Interview
12 is the maximum number of triggers that can be applied to a single table. How to display row numbers with the records? Display row numbers with the records numbers –. Select. from ( select. from employees order by rownum desc) where rownum. – There are 3 big files, 1GB (filea.txt), 10GB (fileb.txt) and 1TB (filec.txt); – The format of these 3 files: each line with a random string in the file; – There is only 100MB memory could be used, disk usage is not limited; – Assumption: IF AND ONLY IF string A appears within all 3 files, we need to count the total appearing times of this A.
Such as, A appears 2 times within filea.txt, appears 10 times within fileb.txt, appears 100 times within filec.txt, then we count the total appearing times of A as 2 + 10 + 100 = 112 times. Question: please write a program to output the strings with TOP 10 and LAST 10 appearing times in descending order. Anyone can answer please.
What are the computing components of oracle grid? The computing componenets of oracle grid are:. Oracle Enterprise Manager and Grid Control. Oracle 10g Database and Real Application Clusters.
ASM Storage Grid. What is server virtualization? Oracle Real Application Clusters 10g (RAC) enables a single database to run across multiple clustered nodes in a grid, pooling the processing resources of several standard machines. What is storage virtualization? The Oracle Automatic Storage Management (ASM) is a feature of Oracle Database 10g which provides a virtual layer between the database and storage so that group of disks can be treated as a single disk group and disks can be dynamically added or removed while keeping databases online.
Also Read Basic to Advanced Oracle SQL Query Interview Question and Answers 7. What is Grid Management feature? The Grid Management feature of Oracle Enterprise Manager 10g provides a single console to manage multiple systems together as a logical group. When oracle allocates an SGA? When Oracle starts, it reads the initialization parameter file to determine the values of initialization parameters.
After this, it allocates an SGA and creates background processes. What is an oracle instance? When you start, the database instance comes into picture into system memory. Combination of the SGA and the Oracle processes is called an Oracle instance. What are the several tools for interacting with the oracle database using sql? There are several tools for interfacing with the database using SQL:. Oracle SQL.Plus and iSQL.Plus.
Oracle Forms, Reports, and Discoverer. Oracle Enterprise Manager. Third-party tools 11. How oracle works?. An instance has started on the database server. A client established a connection to the server, using the proper Oracle Net Services driver.
The server creates a dedicated server process on behalf of the user process. The user executes SQL statement and commits the transaction. The server process receives the statement and checks for any shared SQL area that contains a similar SQL. The server process retrieves data from datafile (table) or SGA. The server process modifies data in the SGA area. The DBWn process writes modified blocks permanently to disk. The LGWR process records the transaction in the redo log file.
The server process sends a message to the application.