Гость
Целевая тема:
Создать новую тему:
Автор:
Форумы / Сертификация и обучение [игнор отключен] [закрыт для гостей] / интересный вопрос... кто как ответит / 10 сообщений из 10, страница 1 из 1
19.04.2005, 14:53
    #33023339
unicode
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
интересный вопрос... кто как ответит
You use the following script to create a view named Employee in the database:

Код: plaintext
1.
2.
3.
CREATE VIEW Employee AS 
SELECT P.SSN, P.LastName, P.FirstName, P. Address, P.city, P.State, P.Birthdate, E.EmployeeID, E.Daepartment, E.Salary 
FROM Person AS P JOIN Employees AS E ON (P.SSN = E.SSN) 

The view will be used by an application that inserts records in both the Person and Employees tables. The script that was used to create these tables is shown below:


Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
CREATE TABLE Person 

( 

SSN char( 11 ) NOT NULL PRIMARY KEY 

LastName varchar ( 50 ) NOT NULL, 

FirstName varchar ( 50 ) NOT NULL, 

Address varchar ( 100 ) NOT NULL, 

City varchar ( 50 ) NOT NULL, 

State char ( 2 ) NOT NULL, 

Birthdate datetime NOT NULL 

) 

GO 

CREATE TABLE Employees 

( 

EmployeeID int NOT NULL PRIMARY KEY, 

SSN char ( 11 ) UNIQUE NOT NULL, 

Department varchar ( 10 ) NOT NULL, 

Salary money NOT NULL, 

CONSTRAINT FKEmpPER FOREIGN KEY (SSN)REFERENCES Person (SSN) 

) 


You want to enable the application to issue INSERT statements against the view. What should you do?

A. Create an AFTER trigger on the view.
B. Create an INSTEAD OF trigger on the view.
C. Create an INSTEAD OF trigger on the Person and Employees tables.
D. Alter the view to include the WITH CHECK option.
E. Alter the view to include the WITH SCHEMA BINDING option.

каков будет ответ.. ?
...
Рейтинг: 0 / 0
19.04.2005, 14:54
    #33023350
unicode
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
интересный вопрос... кто как ответит
я ответил ответ E: но оказалось неправильно.. теперь что-нибудь объяснит мне почему он неправильный, а может я чего-то не понял?
...
Рейтинг: 0 / 0
19.04.2005, 14:56
    #33023353
интересный вопрос... кто как ответит
B.
...
Рейтинг: 0 / 0
19.04.2005, 14:58
    #33023362
unicode
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
интересный вопрос... кто как ответит
а объяснить мне почему?.. наверное я не понял вопрос, ведь если вьюха построена на schema_binding но можно ведь вставлять данные? или я ошибаюсь, просветите меня пожалуйста
...
Рейтинг: 0 / 0
19.04.2005, 14:59
    #33023364
интересный вопрос... кто как ответит
Updatable Views
Microsoft SQL Server 2000 enhances the class of updatable views in two ways:

INSTEAD OF Triggers: INSTEAD OF triggers can be created on a view in order to make a view updatable. The INSTEAD OF trigger is executed instead of the data modification statement on which the trigger is defined. This trigger allows the user to specify the set of actions that need to take place in order to process the data modification statement. Thus, if an INSTEAD OF trigger exists for a view on a given data modification statement (INSERT, UPDATE, or DELETE), the corresponding view is updatable through that statement. For more information about INSTEAD OF triggers, see Designing INSTEAD OF triggers.


Partitioned Views: If the view is of a specified form called 'partitioned view,' the view is updatable, subject to certain restrictions. Partitioned views and their updatability are discussed later in this topic.
When needed, SQL Server will distinguish Local Partitioned Views as the views in which all participating tables and the view are on the same SQL Server, and Distributed Partitioned Views as the views in which at least one of the tables in the view resides on a different (remote) server.

If a view does not have INSTEAD OF triggers, or if it is not a partitioned view, then it is updatable only if the following conditions are satisfied:

The select_statement has no aggregate functions in the select list and does not contain the TOP, GROUP BY, UNION (unless the view is a partitioned view as described later in this topic), or DISTINCT clauses. Aggregate functions can be used in a subquery in the FROM clause as long as the values returned by the functions are not modified. For more information, see Aggregate Functions.


select_statement has no derived columns in the select list. Derived columns are result set columns formed by anything other than a simple column expression, such as using functions or addition or subtraction operators.


The FROM clause in the select_statement references at least one table. select_statement must have more than non-tabular expressions, which are expressions not derived from a table. For example, this view is not updatable:
CREATE VIEW NoTable AS
SELECT GETDATE() AS CurrentDate,
@@LANGUAGE AS CurrentLanguage,
CURRENT_USER AS CurrentUser

INSERT, UPDATE, and DELETE statements also must meet certain qualifications before they can reference a view that is updatable, as specified in the conditions above. UPDATE and INSERT statements can reference a view only if the view is updatable and the UPDATE or INSERT statement is written so that it modifies data in only one of the base tables referenced in the FROM clause of the view. A DELETE statement can reference an updatable view only if the view references exactly one table in its FROM clause.
...
Рейтинг: 0 / 0
19.04.2005, 15:00
    #33023369
интересный вопрос... кто как ответит
Самый полный ответ :)
...
Рейтинг: 0 / 0
19.04.2005, 15:03
    #33023388
интересный вопрос... кто как ответит
Если конечно это для MS SQL. Хотя в ANSI SQL требования практически идентичные.
...
Рейтинг: 0 / 0
19.04.2005, 16:27
    #33023654
unicode
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
интересный вопрос... кто как ответит
и еще


The company stores its sales data in a SQL Server 2000 database. This database contains a table named Orders. There is currently a clustered index on the table, which is generated by using a customer's name and the current date. The Orders table currently contains 750,000 rows, and the number of rows increased by 5 percent each week. The company plans to launch a promotion next week that will increase the volume of inserts to the Orders table by 50 percent.


You want to optimize inserts to the Orders table during the promotion. What should you do?

A. Create a job that rebuilds the clustered index each night by using the default FILLFACTOR.
B. Add additional indexes to the Orders table.
C. Partition the Orders table vertically.
D. Rebuild the clustered index with a FILLFACTOR of 50.
E. Execute the UPDATE STATISTICS statement on the Orders table.
...
Рейтинг: 0 / 0
19.04.2005, 16:28
    #33023663
unicode
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
интересный вопрос... кто как ответит
какие будут ответы?
...
Рейтинг: 0 / 0
19.04.2005, 16:53
    #33023761
unicode
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
интересный вопрос... кто как ответит
ответ D:
...
Рейтинг: 0 / 0
Форумы / Сертификация и обучение [игнор отключен] [закрыт для гостей] / интересный вопрос... кто как ответит / 10 сообщений из 10, страница 1 из 1
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]