`

database questions

 
阅读更多
1.Explain inner and outer joins?

2.Explain a sub-query? How does a sub-query impact on performance?
http://blog.csdn.net/AJAXBloger/article/details/1764506

3.What is normalization? When to denormalize?

4.How do you implement one-to-one, one-to-many and many-to-many relationships while designing tables?
一对多关系

一对多关系是最普通的一种关系。在这种关系中,A 表中的一行可以匹配 B 表中的多行,但是 B 表中的一行只能匹配 A 表中的一行。例如,publishers 和 titles 表之间具有一对多关系:每个出版社出版很多书,但是每本书名只能出自一个出版社。

只有当一个相关列是一个主键或具有唯一约束时,才能创建一对多关系。
多对多关系

在多对多关系中,A 表中的一行可以匹配 B 表中的多行,反之亦然。要创建这种关系,需要定义第三个表,称为结合表,它的主键由 A 表和 B 表的外部键组成。例如,authors 和 titles 表具有多对多关系,这是由于这些表都与 titleauthors 表具有一对多关系。titleauthors 表的主键是 au_id 列(authors 表的主键)和 title_id 列(titles 表的主键)的组合。
一对一关系

在一对一关系中,A 表中的一行最多只能匹配于 B 表中的一行,反之亦然。如果相关列都是主键或都具有唯一约束,则可以创建一对一关系。

这种关系并不常见,因为一般来说,按照这种方式相关的信息都在一个表中。可以利用一对一关系来:
    分割具有多列的表。
    由于安全原因而隔离表的一部分。
    保存临时的数据,并且可以毫不费力地通过删除该表而删除这些数据。
    保存只适用于主表的子集的信息。

http://blog.csdn.net/qking93415981/article/details/1774753

5.How will you map objects to a relational database? How will you map class inheritance to relational data model?
http://blog.csdn.net/chho/article/details/254669
http://blog.csdn.net/chho/article/details/254670

6.What is a view? Why will you use a view? What is an aggregate function?
http://baike.baidu.com/view/71981.htm

7.What is a database trigger?

8.What's the difference between a primary key and a unique key?
Primary key在建立的时候会默认地建立此field的索引,
且此primary key可以作为作为另外的表的foreign key,
再者primary key跟unique得区别是
Primary key 一定是not null,
而unique则没有此限制

9.What are constraints? Explain different types of constraints.
完整性约束用于增强数据的完整性,Oracle提供了5种完整性约束:   
          Check
    NOT NULL
    Unique
    Primary
    Foreign key
http://blog.csdn.net/wenbingcai/article/details/4054054

10.What is an index? What are the types of indexes? How many clustered indexes can be created on a table? What are the advantages and disadvantages of creating separate index on each column of a table?
最大区别在于clustered是物理上实现数据排序,并且同一个表里只能有一个clustered索引,而nonclustered是逻辑上的排序。
There are clustered and nonclustered indexes. A clustered index is a special type of index that reorders the way records in the table are physically stored. Therefore table can have only one clustered index. The leaf nodes of a clustered index contain the data pages.
A nonclustered 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 on disk. The leaf node of a nonclustered index does not consist of the data pages. Instead, the leaf nodes contain index rows.

11.What is procedure? why we are using the procedure?
http://baike.baidu.com/view/68525.htm

12.What is trigger? How many trigger define on a table?
http://baike.baidu.com/view/71792.htm
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics