Question 1. What Is The Difference Between Oracle, Sql And Sql Server ?
- Oracle is based on RDBMS.
- SQL is Structured Query Language.
- SQL Server is another tool for RDBMS provided by MicroSoft.
Question 2. Why You Need Indexing? Where That Is Stored And What You Mean By Schema Object? For What Purpose We Are Using View?
- We can’t create an Index on Index.. Index is stoed in user_index table. Every object that has been created on Schema is Schema Object like Table, View etc. If we want to share the particular data to various users we have to use the virtual table for the Base table. So that is a view.
- Indexing is used for faster search or to retrieve data faster from various table. Schema containing set of tables, basically schema means logical separation of the database. View is crated for faster retrieval of data. It’s customized virtual table. we can create a single view of multiple tables. Only the drawback is..view needs to be get refreshed for retrieving updated data.
PL/SQL Interview Questions
Question 3. Difference Between Stored Procedure And Trigger?
- we can call stored procedure explicitly.
- but trigger is automatically invoked when the action defined in trigger is done.
ex: create trigger after Insert on
- this trigger invoked after we insert something on that table.
- Stored procedure can’t be inactive but trigger can be Inactive.
- Triggers are used to initiate a particular activity after fulfilling certain condition.It need to define and can be enable and disable according to need.
Question 4. What Is The Advantage To Use Trigger In Your Pl?
A trigger is a database object directly associated with a particular table. It fires whenever a specific statement/type of statement is issued against that table. The types of statements are insert,update,delete and query statements. Basically, trigger is a set of SQL statements A trigger is a solution to the restrictions of a constraint. For instance:
- A database column cannot carry PSEUDO columns as criteria where a trigger can.
- A database constraint cannot refer old and new values for a row where a trigger can.
Triggers are fired implicitly on the tables/views on which they are created. There are various advantages of using a trigger. Some of them are:
- Suppose we need to validate a DML statement(insert/Update/Delete) that modifies a table then we can write a trigger on the table that gets fired implicitly whenever DML statement is executed on that table.
- Another reason of using triggers can be for automatic updation of one or more tables whenever a DML/DDL statement is executed for the table on which the trigger is created.
- Triggers can be used to enforce constraints. For eg : Any insert/update/ Delete statements should not be allowed on a particular table after office hours. For enforcing this constraint Triggers should be used.
- Triggers can be used to publish information about database events to subscribers. Database event can be a system event like Database startup or shutdown or it can be a user even like User loggin in or user logoff.
Question 5. What The Difference Between Union And Union All?
Union will remove the duplicate rows from the result set while Union all does’nt.
C++ Interview Questions
Question 6. What Is The Difference Between Truncate And Delete Commands?
Both will result in deleting all the rows in the table .TRUNCATE call cannot be rolled back as it is a DDL command and all memory space for that table is released back to the server. TRUNCATE is much faster.Whereas DELETE call is an DML command and can be rolled back.
Question 7. Which System Table Contains Information On Constraints On All The Tables Created ?
system table contains information on constraints on all the tables created
SQL Database Tutorial SQL Database Interview Questions
Question 8. Explain Normalization ?
Normalisation means refining the redundancy and maintain stabilization. there are Four types of Normalization :first normal forms, second normal forms, third normal forms and fourth Normal forms.
Question 9. How To Find Out The Database Name From Sql*plus Command Prompt?
Select * from global_name;
This will give the database name which u r currently connected to.
MySQL Interview Questions
Question 10. What Is The Difference Between Sql And Sql Server ?
SQLServer is an RDBMS just like oracle,DB2 from Microsoft
Structured Query Language (SQL), pronounced “sequel”, is a language that provides an interface to relational database systems. It was developed by IBM in the 1970s for use in System R. SQL is a de facto standard, as well as an ISO and ANSI standard. SQL is used to perform various operations on RDBMS.
Question 11. What Is Difference Between Co-related Sub Query And Nested Sub Query?
Correlated subquery runs once for each row selected by the outer query. It contains a reference to a value from the row selected by the outer query.
Nested subquery runs only once for the entire nesting (outer) query. It does not contain any reference to the outer query row.
- Correlated Subquery:
select e1.empname, e1.basicsal, e1.deptno from emp e1 where e1.basicsal = (select max(basicsal) from emp e2 where e2.deptno = e1.deptno)
- Nested Subquery:
select empname, basicsal, deptno from emp where (deptno, basicsal) in (select deptno, max(basicsal) from emp group by deptno)
DB2 Using SQL Interview Questions
Question 12. What Operator Performs Pattern Matching?
Pattern matching operator is LIKE and it has to used with two attributes:
- % means matches zero or more characters and
- _ ( underscore ) means matching exactly one character
PL/SQL Interview Questions
Question 13. What Is Cluster.cluster Index And Non Cluster Index ?
Clustered Index:– A Clustered index is a special type of index that reorders the way records in the table are physically stored. Therefore table may have only one clustered index.Non-Clustered Index:- A Non-Clustered index is a special type of index in which the logical order of the index does not match the physical stored order of the rows in the disk. The leaf nodes of a non-clustered index does not consists of the data pages. instead the leaf node contains index rows.
DB2 Using SQL Tutorial
Question 14. What Is The Difference Between A “where” Clause And A “having” Clause?
“Where” is a kind of restriction statement. You use where clause to restrict all the data from DB. Where clause is using before result retrieving. But Having clause is using after retrieving the data. Having clause is a kind of filtering command.
Question 15. What Structure Can You Implement For The Database To Speed Up Table Reads?
Follow the rules of DB tuning we have to:
- properly use indexes ( different types of indexes)
- properly locate different DB objects across different tablespaces, files and so on.
- create a special space (tablespace) to locate some of the data with special datatype ( for example CLOB, LOB and …)
PostgreSQL Interview Questions
Question 16. What Are The Tradeoffs With Having Indexes?
- Faster selects, slower updates.
- Extra storage space to store indexes. Updates are slower because in addition to updating the table you have to update the index.
DocumentDB SQL Tutorial
Question 17. What Is “normalization”? “denormalization”? Why Do You Sometimes Want To Denormalize?
- Normalizing data means eliminating redundant information from a table and organizing the data so that future changes to the table are easier.
- Denormalization means allowing redundancy in a table. The main benefit of denormalization is improved performance with simplified data retrieval and manipulation. This is done by reduction in the number of joins needed for data processing.
SQL DBA Interview Questions
Question 18. What Is A “constraint”?
A constraint allows you to apply simple referential integrity checks to a table.
There are four primary types of constraints:
PRIMARY/UNIQUE – enforces uniqueness of a particular table column. But by default primary key creates a clustered index on the column, where are unique creates a non-clustered index by default. Another major difference is that, primary key doesn’t allow NULLs, but unique key allows one NULL only.
DEFAULT – specifies a default value for a column in case an insert operation does not provide one.
FOREIGN KEY – validates that every value in a column exists in a column of another table.
CHECK – checks that every value stored in a column is in some specified list. Each type of constraint performs a specific type of action. Default is not a constraint. NOT NULL is one more constraint which does not allow values in the specific column to be null. And also it the only constraint which is not a table level constraint.
C++ Interview Questions
Question 19. What Types Of Index Data Structures Can You Have?
An index helps to faster search values in tables. The three most commonly used index-types are: –
- B-Tree: builds a tree of possible values with a list of row IDs that have the leaf value. Needs a lot of space and is the default index type for most databases.
- Bitmap: string of bits for each possible value of the column. Each bit string has one bit for each row. Needs only few space and is very fast.(however, domain of value cannot be large, e.g. SEX(m,f); degree(BS,MS,PHD).
- Hash: A hashing algorithm is used to assign a set of characters to represent a text string such as a composite of keys or partial keys, and compresses the underlying data. Takes longer to build and is supported by relatively few databases.
Question 20. Why Can A “group By” Or “order By” Clause Be Expensive To Process?
Processing of “group by” or “order by” clause often requires creation of Temporary tables to process the results of the query. Which depending of the result set can be very expensive.
SQL Interview Questions
Question 21. What Is A Sql View?
An output of a query can be stored as a view. View acts like small table which meets our criterion. View is a pre-complied SQL query which is used to select data from one or more tables. A view is like a table but it doesn’t physically take any space. View is a good way to present data in a particular format if you use that query quite often. View can also be used to restrict users from accessing the tables directly.
Question 22. What Is Group By?
The GROUP BY keywords has been added to SQL because aggregate functions (like SUM) return the aggregate of all column values every time they are called. Without the GROUP BY functionality, finding the sum for each individual group of column values was not possible.
Question 23. What Are Defaults? Is There A Column To Which A Default Can’t Be Bound?
A default is a value that will be used by a column, if no value is supplied to that column while inserting data. IDENTITY columns and timestamp columns can’t have defaults bound to them.
Explain different isolation levels:
An isolation level determines the degree of isolation of data between concurrent transactions. The default SQL Server isolation level is Read Committed. Here are the other isolation levels (in the ascending order of isolation):
- Read Uncommitted,
- Read Committed,
- Repeatable Read,
MYSQL DBA Interview Questions
Question 24. What Type Of Index Will Get Created After Executing The Below Statement?
- CREATE INDEX myIndex ON myTable(myColumn)
- Non-clustered index. By default a clustered index gets created on the primary key, unless specified otherwise.
SQL Database Interview Questions
Question 25. What’s The Maximum Size Of A Row?