1.
Using the following table structure:
CREATE TABLE PurchaseOrders (
[PurchaseOrderID] [int] NOT NULL REFERENCES Purchasing.PurchaseOrderHeader(PurchaseOrderID)
, [LineNumber] [smallint] NOT NULL
, [ProductID] [int] NULL REFERENCES Production.Product(ProductID)
, [UnitPrice] [money] NULL
, [OrderQty] [smallint] NULL
, [ReceivedQty] [float] NULL
, [RejectedQty] [float] NULL, [DueDate] [datetime] NULL
;)
Create the SELECT statement which returns all rows, in the following column order: Unit Price, ProductID, OrderQty and Due Date, in reverse alphabetical order by ProductID.
2.
Select the correctly formed SQL Statement from the below choices.
Correct Answer
C. INSERT INTO People (ID, Name) VALUES (@@IDENTITY,'Sam')
3.
True or False: Will this statement update the PeopleActive field?
UPDATE dbo.People
SET PeopleActive = 1
HAVING TermDate IS NULL
Correct Answer
B. False
Explanation
The statement "UPDATE dbo.People SET PeopleActive = 1 HAVING TermDate IS NULL" will not update the PeopleActive field. The HAVING clause is used with the GROUP BY clause to filter the results of a query. However, in this case, there is no GROUP BY clause present, so the HAVING clause has no effect. Therefore, the PeopleActive field will not be updated.
4.
Select all the correct answers:
SQL Server 2008 supports the following network protocols:
Correct Answer(s)
C. TCP/IP
D. Named Pipes
F. Shared Memory
Explanation
SQL Server 2008 supports multiple network protocols for communication. The given options list various protocols, and the correct answers are TCP/IP, Named Pipes, and Shared Memory. These protocols allow SQL Server to communicate with client applications over different network environments.
5.
Select the correct clause to finish the below SELECT statement:
SELECT COUNT(ID), ItemName, LastModifiedDate
FROM dbo.Inventory
....
Correct Answer
D. GROUP BY LastModifiedDate, ItemName
Explanation
The correct clause to finish the SELECT statement is "GROUP BY LastModifiedDate, ItemName". This clause is used to group the results by the LastModifiedDate and ItemName columns. It allows for aggregating the COUNT(ID) function and displaying the count of IDs for each unique combination of LastModifiedDate and ItemName.
6.
You have written a stored procedure which uses the @@IDENTITY function to return the last inserted value. This was working correctly until last night when you found out that @@IDENTITY began to return NULL each time.
What tool do you use to diagnose your problem?
Correct Answer
C. SQL Server Profiler
Explanation
SQL Server Profiler is the correct tool to diagnose the problem in this scenario. SQL Server Profiler allows you to capture and analyze events that occur on a SQL Server instance. By using the Profiler, you can trace the execution of the stored procedure and identify any issues or errors that may be causing the @@IDENTITY function to return NULL. This tool provides detailed information about the queries, events, and performance metrics, which can help in troubleshooting and resolving the problem.
7.
Select the correct clause to return information from a table.
Correct Answer
C. SELECT FROM
Explanation
The correct clause to return information from a table is "SELECT FROM". This clause is used in SQL queries to specify the columns that should be retrieved from a table. It allows you to select specific data from one or more tables based on certain conditions, such as filtering by a specific column value or joining multiple tables together. By using the "SELECT FROM" clause, you can retrieve the desired information from a table in a database.
8.
SQL Server 2008 uses Distributed Transaction Services (DTS) as it's primary integration tool.
Correct Answer
B. False
Explanation
SQL Server 2008 does not use Distributed Transaction Services (DTS) as its primary integration tool. Instead, it uses SQL Server Integration Services (SSIS) as its primary integration tool. SSIS is a platform for building high-performance data integration and workflow solutions, including extraction, transformation, and loading (ETL) operations.
9.
Select all appropriate choices:
SQL Server Integration Services connection managers are used to
Correct Answer
A. Connect to different data sources
Explanation
SQL Server Integration Services connection managers are used to connect to different data sources. This means that they provide the necessary functionality to establish connections with various types of databases or other data sources, allowing SSIS packages to retrieve or transfer data from these sources. Connection managers play a crucial role in the overall data integration process, enabling the seamless integration of data from multiple sources into a single destination or performing data transformations and manipulations during the process.
10.
A pre-compiled executable object which contains one or more Transact-SQL statements is called a:
Correct Answer
B. Stored Procedure
Explanation
A stored procedure is a pre-compiled executable object that contains one or more Transact-SQL statements. It is used to group a set of SQL statements into a single unit, which can then be executed repeatedly. Stored procedures provide a way to improve performance and maintainability by reducing the amount of code that needs to be written and executed. They can also be used to implement complex business logic and enforce data integrity rules.
11.
Select the correct T-SQL statement that removes all rows from the table and resets the Identity counter.
Correct Answer
C. TRUNCATE TABLE People
Explanation
The correct answer is TRUNCATE TABLE People. This statement removes all rows from the table and also resets the Identity counter. The other options are incorrect because they either have syntax errors or do not reset the Identity counter. The DELETE statement without specifying any condition will remove all rows from the table but will not reset the Identity counter.
12.
What is the preferred error handling method in SQL Server 2008?
Correct Answer
C. TRY/CATCH
Explanation
The preferred error handling method in SQL Server 2008 is TRY/CATCH. This method allows for structured error handling by enclosing the code that might generate an error within a TRY block, and then catching and handling any errors that occur within a CATCH block. This approach provides more control and flexibility in handling errors, allowing for specific actions to be taken based on the type of error encountered. It also allows for the possibility of nested error handling, where multiple levels of TRY/CATCH blocks can be used to handle errors at different levels of the code.
13.
Choose the incorrect clause.
Correct Answer
D. INSERT FROM
Explanation
The correct answer is INSERT FROM. This is because the correct syntax for inserting data into a table is "INSERT INTO" followed by the table name, not "INSERT FROM". The "SELECT INTO" and "SELECT FROM" clauses are used for retrieving data from a table, while the "INSERT INTO" clause is used for inserting data into a table.
14.
Microsoft SQL Server is an example of a:
Correct Answer
A. Relational Database
Explanation
Microsoft SQL Server is an example of a relational database because it is designed to store and manage data in a structured manner, using tables with rows and columns. It supports the relational model, which allows for the establishment of relationships between different tables through keys. SQL Server also supports the SQL language, which is commonly used to query and manipulate relational databases.
15.
Select the methods you can use to copy data from one SQL Server to another of the same version.
Correct Answer(s)
A. BCP
B. SELECT INTO
C. SQL Server Integration Services
D. SQL Server Import and Export Wizard
Explanation
The methods that can be used to copy data from one SQL Server to another of the same version are BCP (Bulk Copy Program), SELECT INTO, SQL Server Integration Services, and SQL Server Import and Export Wizard. BCP allows for high-speed data transfers between SQL Server instances. SELECT INTO creates a new table and copies data from an existing table into it. SQL Server Integration Services provides a comprehensive platform for data integration and transformation. SQL Server Import and Export Wizard is a graphical tool that simplifies the process of importing and exporting data.