tag:blogger.com,1999:blog-694855878384792308.post7463625188973321999..comments2024-03-21T06:26:49.387-07:00Comments on Java67: Top 10 Frequently asked SQL Query Interview Questions Answersjavin paulhttp://www.blogger.com/profile/15028902221295732276noreply@blogger.comBlogger147125tag:blogger.com,1999:blog-694855878384792308.post-8929946494272328012022-11-11T07:36:18.593-08:002022-11-11T07:36:18.593-08:00You can use substr and instr combinationYou can use substr and instr combinationAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-22924276411359582692022-02-21T00:15:43.461-08:002022-02-21T00:15:43.461-08:00Hi Friends, I have a doubt from SQL Query. Doubt- ...Hi Friends, I have a doubt from SQL Query. Doubt- How to get all the OrderIDs from the Customer(CustomerID) who has given max orders<br /><br />Table- Orders<br />Columns- CustomerID, OrderID<br /><br />CustomerID OrderID<br />101 2000<br />101 1980<br />102 2012<br />103 2045<br />104 2670<br />104 2430<br />104 3200<br /><br />Here, CustomerID 104 user has given max 3 orders.<br />I want to identify this through query. CustomerID and all OrderIDDineshhttps://www.blogger.com/profile/02154003794400449215noreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-80526677868240430902022-02-04T20:50:19.864-08:002022-02-04T20:50:19.864-08:00Hello there, YEs, they are here but they were move...Hello there, YEs, they are here but they were moved to later date because I have updated many of them. you can find them under 2021 or 2020 archives. In fact, you better look at label to see all the posts related to SQL etc. javin paulhttps://www.blogger.com/profile/15028902221295732276noreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-35603436382845170972022-02-04T18:10:48.086-08:002022-02-04T18:10:48.086-08:00Hi javin paul where can i find this question in ar...Hi javin paul where can i find this question in archives. I could see up to year 2016. Please where I can find collective of all questions. Grow With MEhttps://www.blogger.com/profile/14361467364974240064noreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-12501605050236358322021-12-09T22:21:29.031-08:002021-12-09T22:21:29.031-08:00This is an interesting problem, because you need t...This is an interesting problem, because you need to compare each rows to the subsequent rows, I think you can use a correlated subquery javin paulhttps://www.blogger.com/profile/15028902221295732276noreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-1772460956804294722021-12-09T22:17:31.940-08:002021-12-09T22:17:31.940-08:00Hello Anonymous, you can join the two tables on Lo...Hello Anonymous, you can join the two tables on LocationId and then filter for Mumbai.<br />here is how your SELECT query with JOIN look like<br /><br />Select Trade_Id, Counter_Party, , Location, Quantity <br />from Trade_Details t join Location l on t.LocationId = l.LocationId<br />where l.City='Mumbai'<br />and t.quantity > 100javin paulhttps://www.blogger.com/profile/15028902221295732276noreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-91421076526110191382021-12-07T01:54:39.908-08:002021-12-07T01:54:39.908-08:00Hello,
I have one sql question
There are two tab...Hello,<br /><br />I have one sql question<br /><br />There are two tables 1. Trade_details & 2. Location<br />coloums are in 1st tables Trade_id, Counter_Party, Quanity & Location id<br />coloumns are 2nd table Location id & City. <br />so question is : I want to list of trade in mumbai city and quantity is >100Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-14270155532736107642021-11-30T14:56:29.219-08:002021-11-30T14:56:29.219-08:00hello,
i am trying to find out how to write a sele...hello,<br />i am trying to find out how to write a select which takes dates with ratings only when the rating changed against last date compared to next one (in this example it would be 2021-01-31 B, 2021-04-30 A, 2021-07-31 AA+, 2021-10-31 A) - thank you for your advice<br />bidated rating<br />2021-01-31 B <br />2021-02-28 B <br />2021-03-31 B <br />2021-04-30 A <br />2021-05-31 A <br />2021-06-30 A <br />2021-07-31 AA+ <br />2021-08-31 AA+ <br />2021-09-30 AA+ <br />2021-10-31 A tiramisuhttps://www.blogger.com/profile/08909351760994794842noreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-52233865380424257652021-04-25T23:58:12.726-07:002021-04-25T23:58:12.726-07:00Sorry, I don't have database but you can creat...Sorry, I don't have database but you can create your own and just insert some dummy data. There are also <a href="https://javarevisited.blogspot.com/2013/10/database-website-to-run-and-practice-sql-query-online-free.html" rel="nofollow">website</a> which allows you to practice queries. See the link javin paulhttps://www.blogger.com/profile/15028902221295732276noreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-3627274000140713972021-03-31T06:45:27.100-07:002021-03-31T06:45:27.100-07:00Hi very nice, is there a database or table we can ...Hi very nice, is there a database or table we can create to practice the questions Anonymoushttps://www.blogger.com/profile/17627751572642943442noreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-37685862479751228542019-06-08T10:58:43.727-07:002019-06-08T10:58:43.727-07:00select ISDATE('1/08/13') as "MM/DD/YY...select ISDATE('1/08/13') as "MM/DD/YY"; // am getting the output value as 1 // i think ISDATE checks only whether the given value is in date format or not...NChttps://www.blogger.com/profile/09889163853641529253noreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-72020440805189349722019-05-07T04:09:05.990-07:002019-05-07T04:09:05.990-07:00Good list, I recommend "TOP 30 SQL Interview ...Good list, I recommend "TOP 30 SQL Interview Coding Tasks" by Matthew Urban (https://www.amazon.com/TOP-SQL-Interview-Coding-Tasks-ebook/dp/B07GC5RS3K), very good list there, helped with my interview. thanks.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-37310531213238013862019-02-20T04:24:05.454-08:002019-02-20T04:24:05.454-08:00select len(REPLACE('aabacus','a',&...select len(REPLACE('aabacus','a','aa'))-len('aabacus')Anonymoushttps://www.blogger.com/profile/05003890589546468079noreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-88162357332270576652018-12-30T18:23:47.467-08:002018-12-30T18:23:47.467-08:00The first part of the answer to Q11 does not answe...The first part of the answer to Q11 does not answer the first part of the question, it simply states a new problem and answers that.Darronhttps://www.blogger.com/profile/13347201720807042632noreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-40481792800099783732018-12-18T09:21:41.908-08:002018-12-18T09:21:41.908-08:00Anyone help!! There is a table with 2 columns.on...Anyone help!! There is a table with 2 columns.one is Name and the other is marks. How to find the topper of the class without using MAX, LIMIT, ORDER BY functions.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-88265502873124730182018-11-20T08:24:11.201-08:002018-11-20T08:24:11.201-08:00hi, where can i find/practice the questions in thi...hi, where can i find/practice the questions in this table in? is there any online interactive sql table wher ei can practice the joins, ideally with the same dataset? THANK YOUM Ackakzaihttps://www.blogger.com/profile/05906928659037842108noreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-46166495552828901172018-10-21T10:19:06.491-07:002018-10-21T10:19:06.491-07:00Thank you queries are really useful for SQL interv...Thank you queries are really useful for SQL interv preparation Dharahttps://www.blogger.com/profile/09126825738434265450noreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-16651555528032729532018-08-01T06:15:21.752-07:002018-08-01T06:15:21.752-07:00Helpful.. Thank youHelpful.. Thank youAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-28531137450559193762018-06-15T02:08:51.735-07:002018-06-15T02:08:51.735-07:00You can comparison functions , such as UPPER or LO...You can comparison functions , such as UPPER or LOWER , we have in DB2<br /><br />Query becomes :<br /><br />Db2-> Select * from EMPLOYEE where UPPER(EMPNAME) IS LIKE UPPER('%Joe%')<br /><br />This will convert column value into upper and then compare with 'JOE'.<br /><br />Anonymoushttps://www.blogger.com/profile/13753853471643354245noreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-25180836384892310392018-02-17T23:53:06.916-08:002018-02-17T23:53:06.916-08:00select d.dept_name,m.dept_name as dept_id from dep...select d.dept_name,m.dept_name as dept_id from department d INNER JOIN department m ON d.dept_id=m.id<br />order by d.dept_nameashwathyhttps://www.blogger.com/profile/00992612852345360743noreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-71687395302135214012018-02-17T23:52:34.308-08:002018-02-17T23:52:34.308-08:00select d.dept_name,m.dept_name as dept_id from dep...select d.dept_name,m.dept_name as dept_id from department d INNER JOIN department m ON d.dept_id=m.id<br />order by d.dept_nameashwathyhttps://www.blogger.com/profile/00992612852345360743noreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-37503904217786146062017-11-29T23:14:30.758-08:002017-11-29T23:14:30.758-08:00This comment has been removed by the author.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-80900286614004237682017-11-29T23:13:24.105-08:002017-11-29T23:13:24.105-08:00Hi all I just started to learn sql so can u tall m...Hi all I just started to learn sql so can u tall me the detail explanation for the que-11,12 Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-29631059622394392442017-11-28T23:25:01.047-08:002017-11-28T23:25:01.047-08:00SELECT * FROM Employees
WHERE EmpName LIKE '%J...SELECT * FROM Employees<br />WHERE EmpName LIKE '%JOE%<br /><br />Works fine in MsSql Server. It is case insensitive.Anonymoushttps://www.blogger.com/profile/03636343726258990083noreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-85660442419562971202017-11-28T23:23:45.979-08:002017-11-28T23:23:45.979-08:00SELECT * FROM Employees
WHERE EmpName LIKE '%J...SELECT * FROM Employees<br />WHERE EmpName LIKE '%JOE% <br /><br />Works fine in Ms Sql server.. and will find you jOE, jOe, kind of names as well.. it is insensitive.Anonymoushttps://www.blogger.com/profile/03636343726258990083noreply@blogger.com