• 软件测试技术
  • 软件测试博客
  • 软件测试视频
  • 开源软件测试技术
  • 软件测试论坛
  • 软件测试沙龙
  • 软件测试资料下载
  • 软件测试杂志
  • 软件测试人才招聘
    暂时没有公告

字号: | 推荐给好友 上一篇 | 下一篇

面试时最经常被问到的问题(Frenquently asked interview questions)之 Databases 篇

发布: 2007-5-25 20:16 | 作者: 未知 | 来源: Blog | 查看: 87次 | 进入软件测试论坛讨论

领测软件测试网

MILY: Verdana"> 

Databases Questions & Answers

1.      What are two methods of retrieving SQL?
Answer:

2.      What cursor type do you use to retrieve multiple recordsets?
Answer:

3.      What action do you have to perform before retrieving data from the next result set of a stored procedure?
Answer:
Move the cursor down one row from its current position. A ResultSet cursor is initially positioned before the first row. Before you can get to the first row, you would need to Move the cursor down by one row ( For ex: in java the first call to next makes the first row the current row; the second call makes the second row the current row, and so on).

4.      What is the basic form of a SQL statement to read data out of a table?
Answer:
SELECT * FROM table_name;

5.      What structure can you have the database make to speed up table reads?
Answer: The question is not correct. "What structure can you have the database make to speed up table reads?" It is not clear what exactly the term "structure" means in this case. Follow the rules of DB tuning we have to:
1) properly use indexes ( different types of indexes)
2) properly locate different DB objects across different tablespaces, files and so on.
3) Create a special space (tablespace) to locate some of the data with special datatypes( for example CLOB, LOB and ...)
4)...
5)...

6.      What is a "join"?
Answer:
Joins merge the data of two related tables into a single result set, presenting a denormalized view of the data.

7.      What is a "constraint"?
Answer:
A constraint allows you to apply simple referential integrity checks to a table. There are 5 primary types of constraints that are currently supported by SQL Server:
PRIMARY/UNIQUE - enforces uniqueness of a particular table column.
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
NOT NULL - is a constraint which does not allow values in the specific column to be null. And also it is the only constraint which is not a table level constraint.


8.      What is a "primary key"?
Answer:
Primary Key is a type of a constraint enforcing uniqueness and data integrity for each row of a table. All columns participating in a primary key constraint must possess the NOT NULL property.

9.      What is a "functional dependency"? How does it relate to database table design?
Answer:
What functional dependence in the context of a database means is that: Assume that a table exists in the database called TABLE with a composite primary key (A, B) and other non-key attributes (C, D, E). Functional dependency in general, would mean that any non-key attribute - C D or E being dependent on the primary key (A and B) in our table here.
Partial functional dependency, on the other hand, is another corollary of the above, which states that all non-key attributes - C D or E - if dependent on the subset of the primary key (A and B) and not on it as a whole.
Example :
----------
Fully Functional Dependent : C D E --> A B
Partial Functional dependency : C --> A,  D E --> B
Hope that helps!

10.  What is a "trigger"?
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 that execute in response to a data modification/retrieval event on a table.
Other than table triggers there are also schema and database triggers. These can be made to fire when new objects are created, when a user logs in, when the database shutdown etc. Table level triggers can be classified into row and statement level triggers and those can be further broken down into before and after triggers. Before triggers can modify data.

11.  What is "index covering" of a query?
Answer:
A nonclustered index that includes (or covers) all columns used in a query is called a covering index. When SQL server can use a nonclustered index to resolve the query, it will prefer to scan the index rather than the table, which typically takes fewer data pages. If your query uses only columns included in the index, then SQL server may scan this index to produce the desired output.

12. What is a SQL view?
Answer:
View is a precomplied 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.

A view otherwise known as a virtual table is a mere window over the base tables in the database. This helps us gain a couple of advantages:
1) Inherent security exposing only the data that is needed to be shown to the end user
2) Views are updateable based on certain conditions. For example, updates can only be directed to one underlying table of the view. After modification if the rows or columns don't comply with the conditions that the view was created with, those rows disappear from the view. You could use the CHECK OPTION with the view definition, to make sure that any updates to make the rows invalid will not be permitted to run.
3) Views are not materialized (given a physical structure) in a database. Each time a view is queried the definition stored in the database is run against the base tables to retrieve the data. One exception to this is to create a clustered index on the view to make it persistent in the database. Once you create a clustered index on the view, you can create any number of non-clustered indexes on the view.

 

延伸阅读

文章来源于领测软件测试网 https://www.ltesting.net/


关于领测软件测试网 | 领测软件测试网合作伙伴 | 广告服务 | 投稿指南 | 联系我们 | 网站地图 | 友情链接
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备10010545号-5
技术支持和业务联系:info@testage.com.cn 电话:010-51297073

软件测试 | 领测国际ISTQBISTQB官网TMMiTMMi认证国际软件测试工程师认证领测软件测试网