SQL Interview Questions
SQL Interview Questions
select max(sal) From emp where sal NOT IN (select max(sal) from emp);
select * from emp order by sal desc limit 1,1;(starting from 1(2nd record) to 1 record to
retrieve)
delete from dummy where id not in(select min(id) from dummy group by name)
The DROP command removes a table from the database. All the tables' rows, indexes
and privileges will also be removed. ... DROP and TRUNCATE are DDL commands,
whereas DELETE is a DML command. Therefore DELETE operations can be rolled
back (undone), while DROP and TRUNCATE operations cannot be rolled back.
TRUNCATE Removes all rows from a table or specified partitions of a table, without
logging the individual row deletions. TRUNCATE TABLE is similar to the DELETE
statement with no WHERE clause; however, TRUNCATE TABLE is faster and uses
fewer system and transaction log resource.
4.Differance between DBMS and RDBMS.
Table : Stu
Table : stucourse(It acts as a RelationShip between two Tables).
Table: Course
(i)Query:
select a.sname,b.cname
Output:
2nd Query:
Retrive count of all the Courses that are Joined by each student: