Hi Guest

HomePage

1 1

To improves our performance please Like Share Subscribe(Will boost us)

some good sql query
Question Posted on 28 Jul 2011

Home >> DataBase >> SQL Query >> some good sql query

---How to get number of days in a month
select CASE WHEN MONTH(getdate()) IN (1, 3, 5, 7, 8, 10, 12) THEN 31 WHEN MONTH(getdate()) IN (4, 6, 9, 11) THEN 30 ELSE CASE WHEN (YEAR(getdate()) % 4 = 0 AND YEAR(getdate()) % 100 != 0) OR (YEAR(getdate()) % 400 = 0) THEN 29 ELSE 28 END end

---How to get number of row in each table in database
SELECT obj.NAME, ind.rowcnt FROM sysindexes AS ind INNER JOIN sysobjects AS obj ON ind.id = obj.id WHERE ind.indid < 2 AND OBJECTPROPERTY(obj.id, 'IsMSShipped') = 0 ORDER BY obj.NAME

---How to select all duplicate records from a table
select Coloumn_name, count(Coloumn_name) from Table_Name group by field having count(*) > 1

---How to get first day of current week (Sunday)
select DATEADD(DD, 1 - DATEPART(DW, getdate()),getdate())

---How to get first day of current week (Monday)
select DATEADD(DD, 1 - DATEPART(DW, getdate()),getdate()+1)

---How to get number of Maximum connection can be establish to SQL
SELECT @@MAX_CONNECTIONS

----query to convert all the letters in a word to upper case
SELECT UPPER('test')

----round up the values of a number
SELECT CEILING (7.1)

---How to get first day of Month
SELECT DATENAME(dw, DATEADD(dd, - DATEPART(dd, GETDATE()) + 1,GETDATE())) AS FirstDay

---How to know how many tables contains column_name as a column in a database
SELECT COUNT(*) AS Counter FROM syscolumns WHERE (name = 'column_name')
0
0



Most Visited Questions:-

Deep Learning Questions Answers
Below are the different Deep Leaning Questions and answer a More...

Continuous Integration Questions Answers
Below are the 20 odd questions for CI or Continuous Integra More...

Derived relationships in Association Rule Mining are represented in the form of __________.
Derived relationships in Association Rule Mining are repres More...

What is Gulpjs and some multiple choice questions on Gulp
Gulpjs is an open source whihc helps in building Javascript More...

Microservices Architecture Questions Answers
Below are the different questions on Microservices Architec More...




Other Important Questions
How to get the table count in last used query from cache by sending tablename?
Write a SQL query to print 1 to 100 in sql server?
Sql Interview Latest Query questions asked on 30 dec 2020
nth highest number from table
some good sql query






Most Visited Questions
Top Searches:asp net questions vb net questions sql query uddl questions class javascript Questions sharepoint interview questions and concept silverlight questions and concept wcf questions beans general knowledge ajax questions
PHP | Biztalk | Testing | SAP | HR |
     
 
Privacy policy | Terms and Conditions | Blog


If the copyright of any questions or content or syntax belong to you email us we will remove that(info@crackyourinterview.com or crackyourinterview2018@gmail.com)
 

1
Home About Us GroupChat
 
Sitemap Feedback Contact us