SQLTeam.com | Weblogs | Forums

Help on questions


I am posting some interview questions I came across in one of my interviews.

a) This is a scenario. I have a table Table1 with 10 lac rows.I want to delete 9 lac records from the table. What are the steps you follow.?

b) What is the difference between UNION ALL and full outer join.

I have a table Table 1 with Col1 has 5 records
I have a table Table 2 with Col1 has 5 records

What will be the difference in output for UNION ALL and full outer join?

Are you going to offer me a job if I can answer these?

1 Like

I've definitely got to agree with JoTorre on this one. You're applying for a job and you can't even get past some really basic questions on intersections and JOINs and now you want someone to answer them for you. You're not trying at all. Do the research on your own and learn something for a change.

What will be the difference in output for UNION ALL and full outer join?

It's easy enough to create the sample data and just try both of those and see what results you get.

Thanks for the replies..

Please suggest me, any virtual labs environment where I can try out scripts using temp tables for the FULL OUTER JOIN -UNION ALL difference.

Also, please suggest some best methods for the first question, i.e. deleting 9 lac records.

Download a copy of SQL Server 2016 Developers Edition. It's the same as the Enterprise Edition but with special licensing and can run from your desktop (no Windows Server required). You'll need to download SSMS separately and I also recommend downloading "Books Online" to make it easier to find things to study rather than filter through the feldercarb that appears in internet searches.

As for deleteing 9 Lac rows from a 10 Lac table, as yourself what deleting 9 Lac would do to the log file and how long it might take and then figure out how to use "Minimal Logging" to copy 1 Lac of rows to a working table, truncate the original, and copy the rows back would take. Lookup Trace-Flag 610 for that evolution, as well.

Since you don't have a clue as to what FULL OUTER JOINS and UNION ALL are, you should search the Microsoft site or Amazon for certification books for programming in T-SQL.