MemberName varchar50 PRIMARY KEY Valentine Hayden Matthew Table 14.3 TeamMembers Table... You have created a Customers table and an NZCustomers view using the following definitions.… CR
Trang 1A TRUNCATE TABLE EmployeePhoto
B DELETE EmployeePhoto
C DELETE FROM EmployeePhoto
D DROP TABLE EmployeePhoto
8 The HR manager has asked you to create a table that will store candidate resumes These files are created using Microsoft Word 2003 or Microsoft Word
2007, and the HR manager wishes that they are stored in this format It is a requirement that the HR representatives are able to query the table using search engine style syntax How should you create the table?
A CREATE TABLE Resumes
(ResumeID int PRIMARY KEY NULL,
ResumeFile varbinary(max), FileType varchar(10))
B CREATE TABLE Resumes
(ResumeID int PRIMARY KEY,
ResumeFile varbinary(max))
C CREATE TABLE Resumes
(ResumeID int PRIMARY KEY,
ResumeFile varbinary(max), FileType varchar(10))
D CREATE TABLE Resumes
(ResumeID int UNIQUE NULL, ResumeFile varbinary(max), FileType varchar(10))
9 You have a table named TeamMembers containing the data shown in Table 14.3
MemberName varchar(50) PRIMARY KEY
Valentine
Hayden
Matthew
Table 14.3 TeamMembers Table
Trang 2MemberName is the PRIMARY KEY for the table You execute the following
statement:
INSERT TeamMembers Values ('Phil'), ('Valentine'), ('Peter')
Which team members will be present in the TeamMembers table after the
state-ment executes?
A Valentine, Hayden, Matthew, Phil
B Valentine, Hayden, Matthew, Phil, Peter
C Valentine, Hayden, Matthew, Phil, Valentine, Peter
D Valentine, Hayden, Matthew
10 You have created a Customers table and an NZCustomers view using the
following definitions.…
CREATE TABLE Customers
(CustomerID int IDENTITY PRIMARY KEY,
CompanyName varchar(50),
Country varchar(50),
Notes varchar(max));
GO
CREATE VIEW NZCustomers AS
SELECT * FROM Customers WHERE Country = 'New Zealand';
GO
CREATE TRIGGER Trig_NZCustomers
ON dbo.NZCustomers INSTEAD OF INSERT
AS
BEGIN
SELECT CustomerID FROM INSERTED
END
GO
You notice that when you insert data into the NZCustomers view, no error
occurs, but the data does not appear in the table What is the cause of the
problem?
A The Trig_NZCustomers must be dropped because it is preventing the insert
operation
B The view cannot be updated because of the WHERE clause Remove the
WHERE clause from the view.
Trang 3C The IDENTITY column is preventing new CustomerIDs from being generated Redefine the column not to use the IDENTITY attribute.
D You must explicitly call COMMIT TRANSACTION within
Trig_NZCustomers.
11 You are adding a Notes column to a table named Customers You are
instructed that the Notes column must always contain a value, even if the value
is “No notes available.” Unfortunately, many stored procedures you use to add data to the Customers table omit the Notes column, and it is impractical to
redesign the stored procedures What is the easiest way to ensure that the Notes
column in the Customers table always has a value assigned?
A Define the Notes column as NULL Create a default constraint on the
Notes column with the default value of “No notes available.”
B Define the Notes column as NOT NULL Create a default constraint on
the Notes column with the default value of ‘No notes available’
C Define the Notes column as NOT NULL Create a check constraint on
the Notes column
D Define the Notes column as NULL Create a check constraint on the Notes column
12 You have a view that displays records from multiple tables within the same database These tables are managed by different team members Frequently, your view is inaccessible, when someone modifies the underlying tables You are instructed by management that the view must work and be accessible at all times You wish to prevent people from deleting or modifying the tables your view relies on What is the best way to achieve this?
A Use an ALTER TABLE WITH SCHEMABINDING statement to update
each of the source tables
B Use an ALTER TABLE WITH CHECK statement to update each of the
source tables
C Use an ALTER VIEW WITH SCHEMABINDING statement to create
the view
D Use an ALTER VIEW WITH CHECK statement to create the view.
13 You have a large table named CustomerEnquiries There is a clustered index
on the CustomerName column Unfortunately, your users inform you that it
Trang 4takes an excessively long time to add a new customer to the table How should you resolve this issue?
A Use the ALTER INDEX statement with the FILLFACTOR and
PAD INDEX options.
B Use the DROP INDEX statement to drop the index.
C Use the ALTER INDEX statement with the NONCLUSTERED option.
D Use the ALTER INDEX statement with the REBUILD option.
14 You have a table named Customers When a new customer is added, you must
check the CreditRating table for the proposed customer’s credit rating If the
credit rating is below a certain value, you must not allow the customer to be
added to the Customers table What is the best way to achieve this?
A Create a FOR INSERT trigger.
B Create an AFTER INSERT trigger.
C Create an INSTEAD OF INSERT trigger.
D Create a CHECK constraint.
15 You must create a stored procedure that adds a row to the Customers table and returns the ID of the newly inserted customer Select the statement that will
declare the procedure parameters correctly
A CREATE PROC AddNewCustomer
@ID OUT,
@CustomerName varchar(50),
@Notes varchar(max)
AS…
B CREATE PROC AddNewCustomer
@ID int OUT,
@CustomerName varchar(50),
@Notes varchar(max)
AS…
C CREATE PROC AddNewCustomer
@ID int,
@CustomerName varchar(50) OUT,
Trang 5@Notes varchar(max) OUT AS…
D CREATE PROC AddNewCustomer
ID int OUT, CustomerName varchar(50), Notes varchar(max)
AS…
16 You have a table named Orders that contains the OrderID, CustomerID, Amount, and OrderDate columns You must retrieve all orders placed in the
last seven days What criteria should you use with the WHERE clause (select
all that apply)?
A WHERE DateDiff(“week”, OrderDate, GETDATE( )) <= 1
B WHERE DateDiff(“day”, OrderDate, GETDATE( )) <= 7
C WHERE GetDate(“day”, OrderDate, DATEDIFF( )) <= 7
D WHERE GetDate(“day”, OrderDate, DATEDIFF( )) >= 7
17 You have a table named Orders You must make sure that the order date for each order occurs before the ship date What is the best way to achieve this?
A Create a CHECK constraint using CHECK (OrderDate > ShipDate)
statement
B Create a CHECK constraint using CHECK (OrderDate < ShipDate)
statement
C Create an INSTEAD OF INSERT, UPDATE trigger.
D Create a FOR INSERT, UPDATE trigger.
18 You always allow 50 Unicode characters for names of people, and you never allow names to be null You wish to create a user-defined data type that will be used whenever a person’s name must be stored How should you create the data type?
A CREATE TYPE PersonName { FROM varchar(50) NOT NULL }
B CREATE TYPE PersonName { FROM nvarchar(50) NOT NULL }
C CREATE TYPE PersonName { FOR varchar(50) NOT NULL }
D CREATE TYPE PersonName { FROM nvarchar(50)}