SQL development is a language that is easy to learn but hard to master.

Source: Internet
Author: User

SQL development is a language that is easy to learn but hard to master.
Can you briefly describe some database objects used in SQL Server 2000?

The answer you want to hear includes the following objects: tables, views, user-defined functions, and stored procedures. It would be better if they can also mention objects like triggers. If the applicant cannot answer this basic question, this is not a good sign.

What does NULL mean?

NULL (NULL) is a very difficult thing in the database world, so there are a lot of candidates who will fall behind in this issue and you should not be surprised.

NULL indicates UNKNOWN (UNKNOWN): it does not represent "" (empty string ). Assume that your SQL Server database contains ANSI_NULLS. Of course, by default, any comparison of the NULL value produces a NULL value. You cannot compare any value with an UNKNOWN value and want to obtain an answer logically. You must use the is null operator.

What is an index? What types of indexes does SQL Server 2000 contain?

Any experienced database developer should be able to easily answer this question. Some developers with less experience can answer this question, but some may not be clear.

In short, an index is a data structure used to quickly access data in a database table or view. SQL Server has two forms: clustered index and non-clustered index. Clustered indexes store data at the leaf level of the index. This means that no matter which (OR) field of the table exists in the clustered index, these fields will be saved in the table in order. Because of this sort, each table has only one clustered index. A non-clustered index has a row identifier at the leaf level of the index. This row identifier is a pointer to data on the disk. It allows each table to have multiple non-clustered indexes.

What is a primary key? What is a foreign key?

A primary key is a (one or more) Field in a table. It is used only to define rows in the table. The values in the primary key are always unique. A foreign key is a constraint used to establish the relationship between two tables. This relationship generally involves a series of connected fields in a table and another table (although it may be the same table. Then these connected fields are foreign keys.

What is a trigger? What are the different types of triggers in SQL Server 2000?

It is helpful to let future database developers know the available trigger types and how to implement them.

A trigger is a special type of stored procedure, which is bound to a table or view of SQL Server 2000. In SQL Server 2000, there are two triggers: INSTEAD-OF and AFTER. The INSTEAD-OF trigger is a stored procedure that replaces Data Manipulation Language (DML) statements to execute statements on tables. For example, if I have an INSTEAD-OF-UPDATE trigger for TableA and execute an UPDATE statement for this table, the code in the INSTEAD-OF-UPDATE trigger will be executed, instead of the update statement I executed, the operation is not performed.

The AFTER trigger is executed only AFTER the DML statement is used in the database. These types of triggers are useful for monitoring data changes in database tables.

How do you ensure that only the values in the Fld1 field exist in Table B with the Fld1 field, and these values are in the Fld1 field of the table named TableA at the same time?

There are two possible answers to this link-related question. The first answer (and the answer you want to hear) is to use a foreign key restriction. The foreign key restriction is used to maintain the integrity of the reference. It is used to ensure that fields in the table only store values defined in another field in different (or identical) tables. This field is the candidate key (usually the primary key of another table ).

Another answer is the trigger. The trigger can be used to ensure the same effect as the limitation in another way, but it is very difficult to set and maintain, and the performance is generally very bad. For this reason, Microsoft recommends that developers use foreign key restrictions instead of triggers to maintain the integrity of the reference.

What performance considerations do I have to consider if I have too many indexes on a used online transaction processing table?

You are looking for candidates for data manipulation. The more indexes a table has, the more time it takes for the database engine to update, insert, or delete data, because the indexes must be maintained when data control occurs.

What can you use to ensure that fields in a table only accept values in a specific range?

This question can be answered in multiple ways, but only one answer is "good. The answer you want to hear is the Check restriction, which is defined in the database table to restrict the value of the input column.

A trigger can also be used to limit the acceptable values of fields in a database table. However, this method requires that the trigger be defined in the table, which may affect the performance in some cases. Therefore, Microsoft recommends that you use Check instead of other methods to limit domain integrity.

If a candidate can answer this question correctly, his chances are very high, because it indicates that they have experience in using stored procedures.

The returned parameter is always returned by the stored procedure. It indicates whether the stored procedure is successful or failed. The return parameter is always of the INT data type.

The OUTPUT parameter must be specified by the developer. It can return other types of data, such as numeric and numeric values. (There are some restrictions on the data types that can be used as output parameters .) You can use multiple OUTPUT parameters in a stored procedure, but you can only use one response parameter.

What are related subqueries? How to use these queries?

More experienced developers will be able to accurately describe such types of queries.

Related subqueries are special types of queries that contain subqueries. The subquery in the query actually requests the value of the external query to form a loop-like situation.

Related Article

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.