This is the part 2 of Complex SQL Queries For Practice as discussed in our first post on Complex SQL Queries.  We have tried to visit many forums and blogs to gather Questions related to Complex SQL Queries and provide them to you in this series of blog post on Complex SQL Queries for Practice.

These Queries are put together from Internet based research and do not belong to particular individual. Our aim is to help people explore different methods of doing tasks in SQL. We thank the SQL Developer Community to constantly providing solutions to such Complex SQL Questions.

COMPLEX SQL QUERIES - PART 2

1. How Can we only retrieve the Nth row from SQL Database table?
Credits : – Ravi Pachalla provided this solution:
SELECT f1 FROM t1 WHERE rowid = (SELECT rowid FROM t1 WHERE rownum <= 10 MINUS SELECT rowid FROM t1 WHERE rownum < 10);

2. How Can we only retrieve rows X to Y from SQL Database table?

Credits : – Ravi Pachalla provided this solution:
SELECT * FROM tableX WHERE rowid in (SELECT rowid FROM tableX WHERE rownum <= 7
MINUS
SELECT rowid FROM tableX WHERE rownum < 5);

Also Read: 

3. How does one select EVERY Nth row from a table?

One can easily select all even, odd, or Nth rows from a table using SQL queries like this:
Method 1: Using a subquery
SELECT *FROM EMP WHERE (ROWID, 0) IN (SELECT ROWID, MOD (ROWNUM, 4) FROMEMP);

Method 2: Use dynamic views (available from Oracle7.2):
SELECT * FROM (SELECT rownum rn, empno, ename FROM EMP) temp WHERE MOD(temp. ROWNUM, 4) = 0;

4. How to select the TOP N rows from SQL Database table?

Credits : – Stack Exchange provided this solution:
SELECT * FROM my_table a
WHERE 10 >= (SELECT COUNT (DISTINCT maxcol)
FROM my_table b
WHERE b.maxcol >= a.maxcol) ORDER BY maxcol DESC;

5. How to dump or examine the exact content of a database column?

Credits : – Sunder Krishna provided this solution:
SELECT DUMP (col1) FROM tab1 WHERE cond1 = val1;
DUMP (COL1)
————————————-
Typ=96 Len=4: 65,66,67,32

6. How to Receive Messages At Different Session in SQL

Credits : – StackExchange provided this solution:
declare
            a integer;
            b varchar2(30);
begin
            a := dbms_pipe.receive_message(‘mahendran’);
           dbms_pipe.unpack_message(b);
           if a = 0 then
                            dbms_output.put_line(‘successfully received’);
                           dbms_output.put_line(b);
          else
                          dbms_output.put_line(‘not received’);
         end if;
end;

7. How to drop a column from a SQL Database table?

Credits : – W3Schools provided this solution:
ALTER TABLE table_name
DROP COLUMN column_name;

8. How to rename a column in a SQL Database table?

9. How to send messages to Different Sessions in SQL?

Credits : – Ravi Pachalla provided this solution:
Declare
               a integer;
               b integer;
Begin
           a := dbms_pipe.create_pipe(‘Mahendran’);
          dbms_pipe.pack_message(‘Mahendran software is a good company’);
          b := dbms_pipe.send_message(‘Mahendran’);
          if b = 0 then
                               dbms_output.put_line(‘successfully send’);
          else
                               dbms_output.put_line(‘not send’);
         end if;
end;

10. How to change my Oracle User Password?

Credits : – Internet Users provided this solution:
ALTER USER <username> IDENTIFIED BY <new_password>

http://techhowdy.com/wp-content/uploads/2018/05/List-of-Complex-SQL-Queries-For-Practice-–-Part-2-1024x614.pnghttp://techhowdy.com/wp-content/uploads/2018/05/List-of-Complex-SQL-Queries-For-Practice-–-Part-2-150x150.pngDemonDatabase Programminga complex sql query,answering complex sql queries using automatic summary tables,build complex sql queries,building complex and flexible sql queries/commands from c#,c# complex sql queries,complex db2 sql queries examples,complex group by queries sql server,complex join queries in sql server,complex microsoft sql queries,complex ms sql queries,complex nested sql queries,complex nested sql queries examples,complex oracle sql queries asked in interviews,complex oracle sql queries examples pdf,complex oracle sql queries pdf,complex pl sql queries examples,complex queries in sql server 2005,complex queries in sql server 2005+example,complex queries in sql server 2012,complex queries sql server 2008,complex queries using sql,complex sql aggregate queries,complex sql count query,complex sql delete statement,complex sql join queries examples,complex sql or statement,complex sql queries,complex sql queries and answers,complex sql queries asked in interviews,complex sql queries book,complex sql queries bullraider,complex sql queries db2,complex sql queries download,complex sql queries examples,complex sql queries examples for interview,complex sql queries examples in oracle,complex sql queries examples in oracle 10g,complex sql queries examples in sql server 2008,complex sql queries examples in sql server 2008 pdf,complex sql queries examples in teradata,complex sql queries examples with answers pdf,complex sql queries exercise,complex sql queries explained,complex sql queries for etl testing,complex sql queries for interview,complex sql queries for interview pdf,complex sql queries for joins,complex sql queries for practice,complex sql queries for practice in oracle,complex sql queries for practice with answers,complex sql queries for testers,complex sql queries group by,complex sql queries hibernate,complex sql queries in access,complex sql queries in db2,complex sql queries in etl testing,complex sql queries in hibernate,complex sql queries in mysql,complex sql queries in oracle,complex sql queries in oracle pdf,complex sql queries in php,complex sql queries in sql server,complex sql queries in teradata,complex sql queries interview question,complex sql queries interview questions,complex sql queries interview questions and answers,complex sql queries interview questions and answers pdf,complex sql queries interview questions download,complex sql queries interview questions in oracle,complex sql queries joins,complex sql queries multiple tables,complex sql queries mysql,complex sql queries on adventureworks,complex sql queries on emp table,complex sql queries on joins,complex sql queries on northwind database,complex sql queries oracle,complex sql queries pdf,complex sql queries practice,complex sql queries questions and answers,complex sql queries questions pdf,complex sql queries quiz,complex sql queries reports,complex sql queries scenarios,complex sql queries sql server,complex sql queries teradata,complex sql queries test,complex sql queries to practice,complex sql queries tutorial,complex sql queries tutorial pdf,complex sql queries using case,complex sql queries using joins,complex sql queries w3schools,complex sql queries with answers,complex sql queries with examples,complex sql queries with examples pdf,complex sql queries with group by,complex sql queries with joins,complex sql queries with linq,complex sql queries with multiple tables,complex sql queries youtube,complex sql query database,complex sql query in java,complex sql query in ms access,complex sql query in vba,complex sql query inner join,complex sql query problems,complex sql query questions,complex sql query sample,complex sql query writing,complex sql select queries,complex sql select queries examples,complex sql server queries asked in interviews,complex sql server queries examples pdf,complex sql server queries for interview,complex sql server queries interview questions,complex sql subqueries,complex sql update queries,complex sql update statement,creating complex sql queries,design complex sql queries,examples of complex sql queries,how to learn complex sql queries,how to optimize complex sql queries,how to read complex sql queries,how to simplify complex sql queries,how to solve complex sql queries,how to understand complex sql queries,how to write complex sql queries,how to write complex sql queries in oracle,learn complex queries sql server,learn complex sql queries,learn write complex sql queries,list of complex sql queries,more complex sql queries,more sql complex queries triggers views and schema modification,most complex sql queries,practice complex sql queries online,sql complex case statement,sql complex case statement example,sql complex like statement,sql complex queries examples pdf free download,sql complex query optimization,sql complex union query,t sql complex queries,t-sql complex queries examples,top 10 complex sql queries,understanding complex sql queries,very complex sql queries,visualize complex sql queries,writing complex sql queries tutorialThis is the part 2 of Complex SQL Queries For Practice as discussed in our first post on Complex SQL Queries.  We have tried to visit many forums and blogs to gather Questions related to Complex SQL Queries and provide them to you in this series of blog post...Latest technology news