Question 3
Question 3
Question 3
You need to ensure that the following conditions are met when an Insurance is
added or updated in the Insurance_Terms table:
-Each Insurance must have an effective date.
-Each Insurance must have a premium amount that is numeric and greater than
zero.
-Each Insurance must have a review date that is before the termination date.
Your client wants you to fetch data from the emp table in such a way the Salary of
every employee is ranked in desending order without any gaps in the ranks .In
addition , if some employee have the same salary that they should be given in same
rank .Which query should you write to get the desired result?
SELECT empid,emp_sal,
Emp_sales,ROW_NUMBER()OVER (PARTITION BY emp_sales ORDER BY
emp_sal desc)
FROM emp
SELECT empid,emp_sal,
Emp_sales,DENSE_RANK() OVER (PARTITION BY emp_sales ORDER BY
emp_sal desc)
FROM emp
SELECT empid,emp_sal,
Emp_sales,DENSE_RANK() OVER ( ORDER BY emp_sal desc)
FROM emp
SELECT empid,emp_sal,
Emp_sales RANK() OVER (PARTITION BY emp_sales ORDER BY emp_sal desc)
FROM emp
Column_Name Data_Type
ProductID INT
ProductTitle VARCHAR (500)
ProductDescription VARCHAR (4000)
Product_Owner_ID INT
Users of the website should be able to search for the products based on ProductTitle
field .You need to construct a full-text query that ensures the following compliances
when a user launches for search for a product .
-Rows are returned when the exact search phrase is found
-Rows are returned in the order of how well they match the searched phrase
What should you specify in the full-text query?
A CONTAINS predicate
A CONTAINSTABLE function
A FREETEXT predicate
A FREETEXTTABLE function
SELECT Product_ID and Product_Description values for all those rows that
contains the phrase , “HIGH and STRENGTH” are returned.
The Product_ID and Product_Description values for all those rows that
contain either HIGH word or the STRENGTH word in Product_Name.
The ProductID and Product _Description values for all rows containing the
words,HIGH and STRENGTH in the full-text enabled columns along with their
rankings.
The Product_ID and Product_Description values for all those contain both the
words ,HIGH and STRENGTH are returned.
Question No.17 (3M)
You are a database developer on an instance of SQL Server .Your Employee table
was defined using the following Transact SQL statement .
CREATE TABLE Employee(
Employee_ID INT PRIMARY KEY,
Employee_Name NVARCHAR(50),
Manager_ID INT
)
The Employee table contains the data as shown in the following table.
Employee_ID Employee_Name Manager_ID
1 Mike 3
2 David 3
3 Roger NULL
4 Marry 2
5 Joseph 2
6 Ben 2
The management of the organization wants to see the list of employees and their
respective managers .For this you entered the following query.
CREATE VIEW Employee_Manager_Details
WITH SCHEMABINDING
AS
SELECT e1.Employee_Name AS EmployeeName ,e2.Employee_Name AS
ManagerName
FROM dbo.employee e1
INNER JOIN dbo.Employee e2
ON e1.Manager_ID = e2.Employee_ID
But ,the query execution on view tables a long time and you decide to create unique
clustered index on view using the following query.
CREATE UNIQUE CLUSTERED INDEX IX_Empplyee_Manager_Details ON
dbo.Employee_Manager_Details
(
EmployeeName ASC
)
What would be the outcome of the preceding query?
Index gets successfully created and query performance is improved.
You need to create index on Employee_ID rather the on EmployeeName.
You should create unique clustered index on Employee_ID and include
EmployeeName
Index creation will fail because of join condition.
Question No.18 (1M)
Which one of the following system stored procedure is used to see the details of the
database?
sp_helpdb
sp_lock
sp_configure
sp_renamedb
SET XACT_ABORT ON
BEGIN TRANSACTION
INSERT INTO Products VALUES(2,1,500,’11-01-2011’);
INSERT INTO Products VALUES(1,3,0,’01-15-2010’);
INSERT INTO Products VALUES(3,7,250,DEFAULT);
COMMIT TRANSACTION
What is the result of the preceding statements?
The Transact-SQL executes successfully and inserts two rows into the
Products table.
The Transact-SQL generates an error message, but inserts two into the
Products table.
The Transact-SQL generates am error message and rolls back all inserts.
The Transact-SQL executes successfully and inserts three rows into the
Products table.
USE Prod_Salees
EXEC sp_cdc_enable_db
GO
SET cdc_enable_table ‘Products’’Prod_Sales’ ON
GO
USE Prod_Salees
EXEC sys.sp_cdc_enable_db
GO
EXEC sys.sp_cdc_enable_db
@source_schema=’Prod’
@source_name=’Products’
@role_name=’NULL’
GO
USE Prod_Salees
SET cdc_enable_db ON
GO
SET cdc_enable_table ‘Products’’Prod_Sales’ ON
GO
USE Prod_Salee
SET cdc_enable_db ON
GO
EXEC sys.sp_cdc_enable_table
@source_schema=’Products’
@source_name=’Prod_Sales’
@role_name=’NULL’
GO