GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Database  >  SQL Server
Go To First  |  Previous Question  |  Next Question 
 SQL Server  |  Question 31 of 99    Print  
1)What is the maximum value that can be stored for a datetime field?

a. Dec 31, 9999
b. Jun 6, 2079
c. Jan 1, 2753
d. Jan 1, 2100
2)What is the correct SQL syntax for returning all the columns from a table named "Persons" sorted REVERSE alphabetically by "FirstName"?

a. SELECT * FROM Persons WHERE FirstName ORDER BY FirstName DESC
b. SELECT * FROM Persons SORT REVERSE 'FirstName'
c. SELECT * FROM Persons ORDER BY -'FirstName'
d. SELECT * FROM Persons ORDER BY FirstName DESC
SELECT * FROM Persons ORDER BY DESC FirstName
3)What is the correct SQL syntax for selecting all the columns where the "LastName" is alphabetically between (and including) "Hansen" and "Pettersen"?

a. SELECT * FROM Persons WHERE LastName > 'Hansen', LastName < 'Pettersen'
b. SELECT LastName > 'Hansen' AND LastName < 'Pettersen' FROM Persons
c. SELECT * FROM customers WHERE LastName > 'Hansen' AND LastName > 'Pettersen'
d. SELECT * FROM Persons WHERE LastName BETWEEN 'Hansen' AND 'Pettersen'
4)Consider the following queries:
1. select * from employee where department LIKE "[^F-M]%";
2. select * from employee where department = "[^F-M]%";
Select the correct option:

a. Query 2 will return an error
b. Both the queries will return the same set of records
c. Query 2 is perfectly correct
d.Query 2 would return one record less than Query 1


5)Which of the following is not a global variable?

a. @@colcount
b. @@error
c. @@rowcount
d. @@version
e. All are valid global variables
Consider the following two tables:
1. customers( customer_id, customer_name)
2. branch ( branch_id, branch_name )
6)What will be the output if the following query is executed:
Select * branch_name from customers,branch

a. It will return the fields customer_id, customer_name, branch_name
b. It will return the fields customer_id, customer_name, branch_id, branch_name
c. It will return the fields customer_id, customer_name, branch_id, branch_name, branch_name
d. It will return an empty set since the two tables do not have any common field name
e. It will return an error since * is used alone for one table only
7)Which of the following is not a valid Numeric datatypes in SQL Server?

a. INT
b. SMALLINT
c. TINYINT
d. BIGINT
e. MONEY
8)Which of the following datatypes is not supported by SQL-Server?

a. Character
b. Binary
c. Logical
d. Date
e. Numeric
f. All are supported
9)Which of the following are false for batches (batch commands)?

a. Statements in a batch are parsed, compiled and executed as a group
b. None of the statements in the batch is executed if there are any syntax errors in the batch
c. None of the statements in the batch is executed if there are any parsing errors in the batch
d. None of the statements in the batch is executed if there are any fatal errors
in the batch

10) Select the correct option:

a. Optimistic locking is a locking scheme handled by the server, whereas pessimistic locking is handled by the application developer
b. Pessimistic locking is a locking scheme handled by the server, whereas optimistic locking is handled by the application developer
11) How can you view the structure of a table named "myTable" in SQL Server?
a. desc myTable

b. desc table myTable

c. sp_columns myTable

d. None of the above

e. Using either option a or c
12) Which of the following is not a valid binary datatype in SQL Server?

a. BINARY

b. VARBINARY

c. BIT

d. IMAGE
e. TESTAMP
13) Which of the following is false with regards to sp_help?

a. When a procedure name is passed to sp_help, it shows the parameters

b. When a table name is passed to sp_help, it shows the structure of the table
c. When no parameter is passed, it provides a list of all objects and user-defined datatypes in a database

d. All of the above are true
14)Which of the following are false for batches (batch commands)?

a. Statements in a batch are parsed, compiled and executed as a group

b. None of the statements in the batch is executed if there are any syntax errors in the batch

c. None of the statements in the batch is executed if there are any parsing errors in the batch
d. None of the statements in the batch is executed if there are any fatal errors
in the batch

  
Total Answers and Comments: 4 Last Update: October 28, 2009     Asked by: samir khan 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
May 20, 2006 03:18:37   #1  
zulifqar        

RE: Dear friend i need one more favour please I want t...
1)What is the maximum value that can be stored for a datetime field?
  • When a record is inserted into a table containing fields of type DATETIME the DATETIME field(s) are NOT changed.
  • The valid range for the DATETIME field type is '0000-01-01 00:00:00' - '9999-12-31 23:59:59' when used in a string context and '00000000000000' - '99991231235959' when used in a numeric context.


The DATETIME type is eight bytes long.

2)SELECT * FROM Persons ORDER BY FirstName DESC

3) SELECT * FROM Persons WHERE LastName BETWEEN 'Hansen' AND 'Pettersen'

4). Query 2 will return an error


 
Is this answer useful? Yes | No
May 24, 2006 01:31:33   #2  
saravan_btech Member Since: April 2006   Contribution: 6    

RE: Dear friend i need one more favour please I want t...
1)-----------------a2)-----------------b3)-----------------d4)-----------------b5)-----------------c6)-----------------e7)-----------------c8)-----------------c9)-----------------10)---------------11)---------------a12)---------------13)---------------
 
Is this answer useful? Yes | No
August 23, 2006 09:34:46   #3  
ashish jain        

RE: Dear friend i need one more favour please I want t...

1. a. Dec 31 9999

2. d. SELECT * FROM Persons ORDER BY FirstName DESC

3. d. SELECT * FROM Persons WHERE LastName BETWEEN 'Hansen' AND 'Pettersen'

4. a. Query 2 will return an error

5. a. @@colcount

6. e. It will return an error since * is used alone for one table only

7. d. BIGINT (not sure)

8. c. Logical

9.

10. b. Pessimistic locking is a locking scheme handled by the server whereas optimistic locking is handled by the application developer

11. a. desc myTable

12.


 
Is this answer useful? Yes | No
October 27, 2009 11:36:20   #4  
Rsubscribe Member Since: October 2009   Contribution: 1    

RE: 1)What is the maximum value that can be stored for a datetime field? a. Dec 31, 9999 b. Jun 6, 2079 c. Jan 1, 2753 d. Jan 1, 2100 2)What is the correct SQL syntax for returning all the columns from a table named "Persons" sorted REVERSE alphab

Following answers are for SQL Server (few verified on SQL 2005)
1. ... (a)
2. ... (d)
3. ... (d)
4. ... (a)
5. ... (e) In SQL @@Variable is a global variable @Variable local
6. ... (c) It returns cartesian product of both the table columns with last column 'branch_name'
7. ... (e) MONEY - is the only with decimal value with ten-thousandth place for monetary unit. Storage size is 8 bytes. All other are integer only but still the valid data type
8. ... (c) Logical
9. ... (d) Even if any runtime error happens the batch will execute from next SQL statement. Batch Execution will not halt.
10. ... (b)
11. ... (c) sp_columns [For SQL Server] desc myTable [its Oracle]
12. ... (e)
13. ... (d)

14. ... (d) Question repeated above (9)


 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape