Select chapter



Basics (2.papers)
Data Types (2.papers)
Table-designing (1.papers)
Queries-Commands (3.papers)
String functions (2.papers)
Subqueries (1.papers)
Joins (1.papers)
Constraints (1.papers)
Triggers (1.papers)
Hide

Sponsored Links


  

sql interview questions and answers

Please read the below given table for solving questions from 1 to 20
eidfnamelnameagesalarydeptdoj
1rajeevsukla2312000.net23-Oct-11 12:00:00 AM
2sowmyakumari2319000db13-Nov-10 12:00:00 AM
3kishorekumar2736000android16-Oct-11 12:00:00 AM
4abimanyubiswal22nullandroid25-May-10 12:00:00 AM
5sonikumar2421800.net21-Jun-09 12:00:00 AM
6anu_singh2212000db23-Oct-10 12:00:00 AM
7_dineshmoh%anty2315000.net26-Aug-09 12:00:00 AM
8nischala_kumari2218000db19-Jul-08 12:00:00 AM
9gouravchourasia2420000android06-Oct-13 12:00:00 AM
Note: Assume table is present in a database named skillgun , the Schema name is dbo and the table name as Employees ;
Show Answer
Share Facebook gmail Twitter
2
Which of the following syntax is the correct syntax for displaying the current systems date and time using getdate function?
  1. select getdate() as 'currentdatetime'
  2. select getdate as 'currentdatetime' 
  3. None of the above.
Show Answer
Share Facebook gmail Twitter
3
What is the difference between getdate and getutcdate functions ?
  1. Both will give same date and time any where in the world.
  2.  getutcdate function will give universal time or greenwhic mean time and getdate function will give current system time.
  3. getutcdate will return current date as well as time up to 100 milli seconds accuracy but getdate function will give date and time up to minutes only.
  4. None of the above.
Show Answer
Share Facebook gmail Twitter
4
What is the use of current_timestamp function?
  1. current_timestamp used for displaying current system time.
  2. current_timestamp function used for displaying current system date and time.
  3. current_timestamp function returns current system date.
  4. None of the above.
Show Answer
Share Facebook gmail Twitter
5
What is the use of a day function?
  1. day function always returns current day name.
  2. day function always returns day name for the given date.
  3. day function returns day number or date value for the given date.
  4. None of the above.
Show Answer
Share Facebook gmail Twitter
6
What is the use of month function?
  1. month function always returns month number for the given date.
  2. month function returns month name like january or february etc .. For the current date.
  3. month function always returns month name ( like January,February etc..) for the given date.
  4. None of the above.
Show Answer
Share Facebook gmail Twitter
7
Which of the following queries is used to display the current day number in SQL?
  1. select day(getdate()) as 'currentday'
  2. select getdate() as 'currentdate' 
  3. select current_timestamp as 'date'
  4. None of the above.
Show Answer
Share Facebook gmail Twitter
8
Which of the following queries is used to display the current month number in SQL?
  1. select month(getdate()) as 'currentmonth' ;
  2. select month(current_timestamp) as 'currentmonth';
  3. First and second options will give correct output ;
  4. None of the above.
Show Answer
Share Facebook gmail Twitter
9
What is the use of year function?
  1. year function returns current system year number.
  2. year function returns year number for the given input date.
  3. None of the above.
Show Answer
Share Facebook gmail Twitter
10
Which of the following queries is used to display the current year number in SQL?
  1. select year(getdate()) as 'currentyear'
  2. select year(current_timestamp) as 'currentyear'
  3. Both first and second option are correct.
  4. None of the above.
Show Answer
Share Facebook gmail Twitter
11
Which of the following queries is used to display the current date and time in mon dd yyyy hh:miAM (or PM) format?
  1. select convert(varchar(30),getdate(),0)
  2. select convert(varchar(30),getdate(),1)
  3. select convert(varchar(30),getdate(),2)
  4. None of the above.
Show Answer
Share Facebook gmail Twitter
12
Which of the following queries is used to display the current date in yyyy.mm.dd format?
  1. select convert(varchar(20),getdate(),103)
  2. select convert(varchar(20),getdate(),104)
  3. select convert(varchar(20),getdate(),105)
  4. select convert(varchar(20),getdate(),102)
Show Answer
Share Facebook gmail Twitter
13
Which of the following queries is used to display the current date in dd/mm/yyyy format ?
  1. select convert(varchar(20),getdate(),105)
  2. select convert(varchar(20),getdate(),103)
  3. select convert(varchar(20),getdate(),104)
  4. select convert(varchar(20),getdate(),101)
Show Answer
Share Facebook gmail Twitter
14
Which of the following queries is used to display the current date in German format ( that is in dd.mm.yyyy ) ?
  1. select convert(varchar(20),getdate(),104)
  2. select convert(varchar(20),getdate(),105)
  3. select convert(varchar(20),getdate(),106)
  4. select convert(varchar(20),getdate(),107)
Show Answer
Share Facebook gmail Twitter
15
Which of the following queries is used to display current time in hh:mm:ss format ?
  1. select convert(varchar(20),getdate(),109)
  2. select convert(varchar(20),getdate(),108)
  3. select convert(varchar(20),getdate(),107)
  4. select convert(varchar(20),getdate(),110)
Show Answer
Share Facebook gmail Twitter
16
Which of the following queries is used to display current date in USA format ( that is in mm-dd-yyyy )?
  1. select convert(varchar(20),getdate(),110)
  2. select convert(varchar(20),getdate(),111)
  3. select convert(varchar(20),getdate(),112)
  4. select convert(varchar(20),getdate(),113)
Show Answer
Share Facebook gmail Twitter
17
Which of the following queries is used to display the week day name for the current date?
  1. select datename(weekday,getdate())
  2. select datename(dayname,getdate()) as 'weekdayname'
  3. select datename(day,getdate()) as 'weekdayname' ;
  4. None of the above.
Show Answer
Share Facebook gmail Twitter
18
Which of the following queries is used to display current time in hours?
  1. select datename(hours,getdate())
  2. select datename(hour,getdate())
  3. select hour(getdate())
  4. None of the above.
Show Answer
Share Facebook gmail Twitter
19
What is the use of DateAdd function in SQL?
  1. dateadd function used for adding given number of days or months or years for the given date.
  2. dateadd function can be used for adding two or more dates.
  3. None of the above.
Show Answer
Share Facebook gmail Twitter
20
Which of the following queries is used to  add 10 days to the given date ( '10-05-2014')?
  1. select date(DAY,10,'10-05-2014')
  2. select dateadd(10,DATE,'10-05-2014')
  3. select dateadd(DAY,10,'10-05-2014')
  4. None of the above.
Show Answer
Share Facebook gmail Twitter
Read more papers :