随笔 - 50  文章 - 8  trackbacks - 0
<2010年3月>
28123456
78910111213
14151617181920
21222324252627
28293031123
45678910

常用链接

留言簿

随笔档案

Blogs

搜索

  •  

最新评论

阅读排行榜

评论排行榜

1.      What are two methods of retrieving【v 取回;恢复;补偿;(美)(计算机的)检索(retrieveing形式)SQL?

Answer:

SELECT statement, cursors

   

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

Answer:

Explicit cursor can be used to retrieve and return the multiple records. Ref cursor also do the same job.

   

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

   

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

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 非聚集索引nonclustered index)是建立的索引表(个人觉得,就是查询目录嘛)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.


文章来源:http://sohu2000000.spaces.live.com/Blog/cns!87FC8F72BEB4FD03!423.entry
posted on 2010-03-22 16:47 sohu2000000 阅读(107) 评论(0)  编辑 收藏 引用

只有注册用户登录后才能发表评论。
网站导航:   博客园   博客园最新博文   博问   管理