Thursday, January 14, 2010

Database System-III

1. What is a "primary key"?
Ans : A PRIMARY INDEX or PRIMARY KEY is something which comes mainly from database theory. From its behavior is almost the same as an UNIQUE INDEX, i.e. there may only be one of each value in this column. If you call such an INDEX PRIMARY instead of UNIQUE, you say something about your table design, which I am not able to explain in few words. 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.

2. What is a "functional dependency"? How does it relate to database table design?
Ans : Functional dependency relates to how one object depends upon the other in the database. for example, procedure/function sp2 may be called by procedure sp1. Then we say that sp1 has functional dependency on sp2.

3. What is a "trigger"?
Ans : Triggers are stored procedures created in order to enforce integrity rules in a database. A trigger is executed every time a data-modification operation occurs (i.e., insert, update or delete). Triggers are executed automatically on occurance of one of the data-modification operations. 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: 1.A database column cannot carry PSEUDO columns as criteria where a trigger can. 2. A database constraint cannot refer old and new values for a row where a trigger can.

4. Why can a "group by" or "order by" clause be expensive to process?
Ans : 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.

5. What is "index covering" of a query?
Ans : Index covering means that "Data can be found only using indexes, without touching the tables"


6. What is a SQL view?
Ans : An output of a query can be stored as a view. View acts like small table which meets our criterion. 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.


7. What are two methods of retrieving SQL?
Ans : Use SELECT Query and Projection Relational Algebra to retrieve SQL.


8. What cursor type do you use to retrieve multiple recordsets?
Ans : Explicit Cursor has been used to retrieve multiple records at a time.


9. What types of join algorithms can you have?
Ans : Natural Join, Equi Join, Inner Join, Outer Join (Left Outer Join ,Right Outer Join, Full Outer Join), Cross Join, Self Join, etc.

No comments:

Post a Comment

Open Researcher and Contributor ID (ORCID)

Search Aptipedia