Skip to main content

SQL real-time interview Queries along with answers sources

 Hi All, 

Today I was inspired by few sites where I saw few SQL queries that are been asked in interviews a lot and wanted to share with you all. So, that everyone can benefit of it.

https://www.techbeamers.com/sql-query-questions-answers-for-practice/ 

https://www.complexsql.com/real-time-scenarios-in-sql-queries/  

https://www.complexsql.com/complex-sql-queries-examples-with-answers/complex-sql-for-interviews/ 

https://www.interviewbit.com/sql-interview-questions/

https://www.softwaretestingmaterial.com/sql-interview-questions/

Comments

Popular posts from this blog

SQL Real Time Interview Questions with solutions

SQL_Query : In this MySQL challenge, your query should return the names of the people who are reported to (excluding null values), the number of members that report to them, and the average age of those members as an integer. The rows should be ordered by the names in alphabetical order. Your output should look like the  following table . Solution : SELECT  ReportsTo ,   count ( ReportsTo )   as  Members ,   round ( avg ( Age ),   0 )   as   'Average Age'     FROM  maintable_MS9H0 Where  ReportsTo  is   not   null Group   by  ReportsTo order   by  ReportsTo or SELECT  ReportsTo , COUNT ( FirstName )   as  Members , ROUND ( AVG ( Age ))   as   "Average Age"   FROM  maintable_MS9H0  WHERE  ReportsTo  IS   NOT   NULL   GROUP   BY  ReportsTo SQL_Query: In this MySQL challenge, the ta...

Joins in NoSQL world

                             : Joins in NoSQL world: Here in NoSQL world, we have $lookup aggregate function for performing joins and it performs left outer equi-join functionality. This aggregate function is only available from MongoDB 3.2 versions only. The Left outer equi-join produces a result set that contains data for all documents from the left table (collection) together with data from the right table (collection) for documents where there is a match with documents from the left table (collection). See the diagram below                      $lookup – Left Outer Equi-Joins Below diagram illustrates the syntax for performing the join: 1)    leftCollection is the collection that the aggregation is being performed on and is the left collection in the join 2)    from identifies the collection that it will be joined with – the ...

NoSQL Document Database Queries

  -           To check the current database list cmd> show dbs; -           To drop database cmd> db.dropdatabase( ); -           To create collection cmd> db.createCollection(“collection name”); or Use <collection name> -           To insert a document into the collection cmd> db.collectionname.insert([{}]); //insert many documents or one document           db.collectionname.insertOne({}); //inserts one document           db.collectionname.insertMany([{},{}]); //insert many documents -           To Print data in Json format cmd> db.collectionname.find( ).forEach(printjson); -        ...