Understanding Complex SQL codes

Hi,

I am working on some complex SQL code written by previous developers.

I am looking the approaches to understand complex queries. I have good development experience but this code is giving me tough time and I would like ot fasten my approach 

I have googled but thought this is a right place

Cheers


  • Edited by NZ-D Wednesday, July 15, 2015 4:48 AM
July 15th, 2015 4:48am

I cant share the code

I just  need some tips like mentioned the post 

http://stackoverflow.com/questions/379062/best-way-to-understand-complex-sql-statements


  • Edited by NZ-D Wednesday, July 15, 2015 5:00 AM
Free Windows Admin Tool Kit Click here and download it now
July 15th, 2015 5:00am

Hi NZ-D,

When mentioning complex SQL query, the first image comes to my mind is the query with multiple derived tables and joins. For me, to make it much clearer, I would replace the derived tables with Common Table Expression(CTE) and then check what exists in each CTE. After the replacement I would play the query with less sample data. Hope there exists proper comments in your queries.

By the way, a well formatted query is much easier to understand. A good notepad editor such as
Notepad++ can help to format.

If you have any question, feel free to let me
July 15th, 2015 10:50pm

well thanks

I hope someone else replies to this post 

I agree with Stan you have to show us the code at least dummy code. You can replace real table names with dummy one and paste at least a part of it

Free Windows Admin Tool Kit Click here and download it now
July 16th, 2015 1:20am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics