INDIA
Home
Books
Videos
Test Skills
Buy Now
Company
Other Links
Contact Us
Featured Video
Featured Book
Test Module :
To know about what level you should start from, here’s an online test that lets you determine your current SQL awareness levels.
After we receive the Test answers from you, we will recommend you suitable books and videos to prime up your knowledge.
Question : 1
You have a table name CurrentProducts and need to display just the [ProductName] and [Category]. You want the highest [RetailPrice] listed first and the lowest price listed last. Which query should you use?
Answer :
SELECT ProductName, Category FROM CurrentProducts ORDER BY ProductName, Category DESC
SELECT * FROM CurrentProducts ORDER BY ProductName, Category DESC
SELECT ProductName, Category FROM CurrentProducts ORDER BY RetailPrice ASC
SELECT ProductName, Category FROM CurrentProducts ORDER BY RetailPrice DESC
Question : 2
Your manager wants to see all employees in alphabetical order for each state. She has asked you to sort by State, LastName, and FirstName columns. Without creating any additional tables how can you view this report?
Answer :
Specify State, LastName, and FirstName in the ORDER command.
Create a file format that has an export operation.
Specify State, LastName, and FirstName in the ORDER BY clause
Copy the data into a new table that has a clustered index set on State, LastName, and FirstName
Question : 3
You have tables named dbo.SalesInvoice and dbo.SalesInvoiceDetail. CustomerID is located in the SalesInvoice table and InvoiceID is located in both tables. You have been told to show the discount amounts from the SalesInvoiceDetail table that correspond to the sales of a specific CustomerID of 490. Which Transact SQL statement should you use?
Answer :
SELECT CustomerID, DiscountAmt FROM dbo.SalesInvoiceDetail sd INNER JOIN dbo.SalesInvoice si ON sd.InvoiceID= si.InvoiceID WHERE si.CustomerID= 490
SELECT CustomerID, DiscountAmt FROM dbo.SalesInvoiceDetail sd WHERE si.CustomerID= 490
SELECT CustomerID, DiscountAmt FROM dbo.SalesInvoiceDetail sd WHERE EXISTS (dbo.SalesInvoice si ON sd.InvoiceID= si.InvoiceID WHERE si.CustomerID= 490)
Question : 4
You need to find all records in your Employee table that have a null value for the LocationID field. Which criterion should you use in your query?
Answer :
WHERE LocationID = ‘null’
WHERE LocationID IS ‘null’
WHERE LocationID = null
WHERE LocationID IS null
Question : 5
You need to take the number 3.85 and round to the nearest whole number while still keeping the decimal place. 3.85 should round to 4.00. Which code will achieve this result?
Answer :
SELECT ROUND(3.85, 0)
SELECT ROUND(3.85, 2)
SELECT ROUND(3.85, 1.00)
SELECT UPPER(3.85, 2, 0)
Question : 6
How does ORDER BY work with null?
Answer :
ORDER BY ignores nulls in a random manner.
ORDER BY puts all nulls first in ascending order
ORDER BY puts all nulls first in descending order.
Question : 7
You are writing a query that returns a list of products which have grossed more than $2,000,000 during the year 2007. Which clause allows you to filter on aggregated totals?
Answer :
ON
WHERE
HAVING
GROUP BY
Question : 8
You want to display each grant in your [Grant] table and have an expression field that shows the total amount of all Grants. Which query should you use?
Answer :
SELECT *, COUNT(Amount) OVER ( ) as CompanyTotal FROM [Grant]
SELECT *, Sum(Amount) OVER ( ) as CompanyTotal FROM [Grant]
SELECT *, COUNT(Amount) as CompanyTotal FROM [Grant] GROUP BY *
SELECT *, Sum(Amount) as CompanyTotal FROM [Grant] GROUP BY *
Question : 9
You want to show all fields of the Employee table. You want an additional field called StartDate that shows the first HireDate for all Employees. Which query should you use?
Answer :
SELECT *, Min(HireDate) as StartDate FROM Employee
SELECT *, Max(HireDate) as StartDate FROM Employee
SELECT *, Min(HireDate) OVER() as StartDate FROM Employee
SELECT *, Max(HireDate) OVER() as StartDate FROM Employee
Question : 10
You have 1 million rows to delete from the TempProducts table. If the field called “PlsDelete” is marked with a 1, then that row should be deleted. You have been asked to delete 5000 rows at a time. You need to write a TransactSQL batch that will delete exactly 5000 rows. Which TransactSQL batch should you use?
Answer :
DELETE TOP (5000) dbo.TempProducts WHERE PlsDelete = 1
DELETE TOP (5000) dbo.TempProducts WHERE PlsDelete != 1
DELETE BOTTOM (5000) dbo.TempProducts WHERE PlsDelete = 1
DELETE BOTTOM (5000) dbo.TempProducts WHERE PlsDelete != 1
Enter Your Email:
Which city are you from ?
Any remarks ?
Home
|
Site Map
|
Privacy Policy
|
Disclaimer
|
Contact Us
Copyright © 2011 Joes2Pros.com. All rights reserved.
Website Designed and Marketed by
Blue Digital
Online Shopping