The most frequently asked question at the interview (Frenquently asked interview questions) Databases Chapter

Source: Internet
Author: User
Tags definition insert key sql query
Problem


Databases Questions & Answers

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

2. What cursor type Do you have to retrieve multiple recordsets?
Answer:

3. What action do your have to perform before retrieving data from the next result set of a stored procedure?
Answer:move the cursor down one row to its current position. A ResultSet Cursor is initially positioned before the "A". Before you can get to the "the" the "the" the "the" would need to move the cursor down by one row (for Ex:in Java the Next makes the the current row; The second call makes the second row, "The current row, and".

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 isn't 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 spaces (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 to the apply simple referential integrity checks to A table. There are 5 primary types of constraints that are currently by SQL Server:
Primary/unique-enforces uniqueness of a particular table column.
Default-specifies a default value for a column in case a 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 is 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 the a constraint enforcing uniqueness and data integrity for each row of a table. All columns participating in a PRIMARY KEY constraint must the ' not NULL ' property.

9. What is a "functional dependency"? How do you does it relate to database table?
Answer:what functional dependence in the "a" database means is that:assume this a table exists in the database Called TABLE with a composite primary key (A, B) and Non-key attributes (C, D, E). Functional dependency in general, would mean so any non-key attribute-c D or E being dependent on the primary key (a A nd B) in my table here.
Partial functional dependency, on the other hand, is another corollary of the above, which states this all Non-key Attribu Tes-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!

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 to that table. The types of statements are INSERT, UPDATE, delete and query statements. Basically, Trigger is a set of SQL statements This execute in response to a data Modification/retrieval event on a table.
The other than table triggers there are also schema and database triggers. These can is made to fire when new objects are created, when a user logs in, and when the database shutdown etc. Table level triggers can classified to row and statement level triggers and those can is further broken down into BEF Ore and after triggers. Before triggers can modify data.

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 query, it would prefer to scan the index rather the table, Which typically takes fewer data pages. If your query uses only columns included at the index, then SQL server may scan this index to produce the desired output.

What is a SQL view?
Answer:view is a precomplied SQL query which are used to select data from one or more tables. A view is like a table but it doesn ' t physically take any spaces. View is a good way to present data in a particular format if you use this 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 windows over the base tables in the database. This helps us gain a couple of advantages:
1) Inherent security exposing only the data this is needed to being shown to the end user
2) Views are updateable based on certain conditions. For example, updates can is directed to one underlying table of the view. After modification if the rows or columns don's comply with the conditions this view is created with, those rows Disa Ppear from the view. You are could use the CHECK OPTION with the view definition and to make sure so any updates to make the rows invalid would not B e 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" base tables to retrieve the data. One exception to the "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.





Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.