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 errorsin 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 c12) Which of the following is not a valid binary datatype in SQL Server?a. BINARY b. VARBINARY c. BIT d. IMAGEe. TESTAMP13) 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 tablec. 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 true14)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 batchd. None of the statements in the batch is executed if there are any fatal errorsin the batch

Showing Answers 1 - 9 of 9 Answers

zulifqar

  • May 20th, 2006
 

  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

  Was this answer useful?  Yes

1)-----------------a2)-----------------b3)-----------------d4)-----------------b5)-----------------c6)-----------------e7)-----------------c8)-----------------c9)-----------------10)---------------11)---------------a12)---------------13)---------------

  Was this answer useful?  Yes

ashish jain

  • Aug 23rd, 2006
 

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. 

  Was this answer useful?  Yes

Rsubscribe

  • Oct 27th, 2009
 

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)

  Was this answer useful?  Yes

1. a.Dec 31, 9999

2. a. SELECT * FROM Persons WHERE FirstName ORDER BY FirstName DESC
suggested: SELECT <column_names> FROM Persons WHERE FirstName ORDER BY FirstName DESC

3. d. SELECT * FROM Persons WHERE LastName BETWEEN 'Hansen' AND 'Pettersen'
suggested: SELECT <column_names> FROM Persons WHERE LastName BETWEEN 'Hansen' AND 'Pettersen'

4. a. Query 2 will return an error
suggested: Both the query will return an error

5. @@colcount

6. It will return the fields customer_id, customer_name, branch_id, branch_name, branch_name

7. All are numeric

8. c. Logical

9. d. None of the statements in the batch is executed if there are any fatal errors in the batch (fatal errors are the runtime error)

10. a. Optimistic locking is a locking scheme handled by the server, whereas pessimistic locking is handled by the application developer (not sure)

11. c. sp_columns myTable

12. e. TESTAMP

13) d. All of the above are true

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

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions