InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
What's The Maximum Size Of A Row? |
|
Answer» 8060 BYTES. 8060 bytes. |
|
| 2. |
What Type Of Index Will Get Created After Executing The Below Statement? |
| Answer» | |
| 3. |
What Are Defaults? Is There A Column To Which A Default Can't Be Bound? |
|
Answer» 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):
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): |
|
| 4. |
What Is Group By? |
|
Answer» 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. 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. |
|
| 5. |
What Is A Sql View? |
|
Answer» 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. 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. |
|
| 6. |
Why Can A "group By" Or "order By" Clause Be Expensive To Process? |
|
Answer» 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. 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. |
|
| 7. |
What Types Of Index Data Structures Can You Have? |
|
Answer» An index helps to faster search values in tables. The THREE most commonly used index-types are: -
An index helps to faster search values in tables. The three most commonly used index-types are: - |
|
| 8. |
What Is A "constraint"? |
|
Answer» 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. 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. |
|
| 9. |
What Is "normalization"? "denormalization"? Why Do You Sometimes Want To Denormalize? |
Answer»
|
|
| 10. |
What Are The Tradeoffs With Having Indexes? |
| Answer» | |
| 11. |
What Structure Can You Implement For The Database To Speed Up Table Reads? |
|
Answer» Follow the rules of DB tuning we have to:
Follow the rules of DB tuning we have to: |
|
| 12. |
What Is The Difference Between A "where" Clause And A "having" Clause? |
|
Answer» "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. "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. |
|
| 13. |
What Is Cluster.cluster Index And Non Cluster Index ? |
|
Answer» 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. 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. |
|
| 14. |
What Operator Performs Pattern Matching? |
|
Answer» Pattern MATCHING OPERATOR is LIKE and it has to used with TWO attributes:
Pattern matching operator is LIKE and it has to used with two attributes: |
|
| 15. |
What Is Difference Between Co-related Sub Query And Nested Sub Query? |
|
Answer» 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. For example,
select e1.empname, e1.basicsal, e1.deptno from emp e1 where e1.basicsal = (select max(basicsal) from emp e2 where e2.deptno = e1.deptno)
select empname, basicsal, deptno from emp where (deptno, basicsal) in (select deptno, max(basicsal) from emp group by deptno) 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. For example, select e1.empname, e1.basicsal, e1.deptno from emp e1 where e1.basicsal = (select max(basicsal) from emp e2 where e2.deptno = e1.deptno) select empname, basicsal, deptno from emp where (deptno, basicsal) in (select deptno, max(basicsal) from emp group by deptno) |
|
| 16. |
What Is The Difference Between Sql And Sql Server ? |
|
Answer» SQLServer is an RDBMS just like oracle,DB2 from Microsoft whereas 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. SQLServer is an RDBMS just like oracle,DB2 from Microsoft whereas 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. |
|
| 17. |
How To Find Out The Database Name From Sql*plus Command Prompt? |
|
Answer» SELECT * from global_name; This will GIVE the DATABASE name which u r currently connected to. Select * from global_name; This will give the database name which u r currently connected to. |
|
| 18. |
Explain Normalization ? |
|
Answer» 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. 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. |
|
| 19. |
Which System Table Contains Information On Constraints On All The Tables Created ? |
|
Answer» USER_CONSTRAINTS, system table CONTAINS INFORMATION on constraints on all the tables CREATED USER_CONSTRAINTS, system table contains information on constraints on all the tables created |
|
| 20. |
What Is The Difference Between Truncate And Delete Commands? |
|
Answer» 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. 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. |
|
| 21. |
What The Difference Between Union And Union All? |
|
Answer» UNION will REMOVE the duplicate ROWS from the result SET while Union all does'nt. Union will remove the duplicate rows from the result set while Union all does'nt. |
|
| 22. |
What Is The Advantage To Use Trigger In Your Pl? |
|
Answer» 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:
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:
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: 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: |
|
| 23. |
Difference Between Stored Procedure And Trigger? |
Answer»
ex: create trigger after Insert on
ex: create trigger after Insert on |
|
| 24. |
Why You Need Indexing? Where That Is Stored And What You Mean By Schema Object? For What Purpose We Are Using View? |
Answer»
|
|