11. Which system table contains information on privileges granted and privileges
12. Which system table contains information on constraints on all the tables created?
13. What is the output of the following query SELECT TRUNC(1234.5678, -2) FROM DUAL;
14. What is the use of DESC in SQL?
DESC has two purposes. It is used to describe a schema as well as to retrieve rows from table in descending order.
The query SELECT * FROM EMP ORDER BY ENAME DESC will display the output
sorted on ENAME in descending order.
15. State True or False: EXISTS, SOME, ANY are operators in SQL?
16. There are two tables, Employee and Department. There are few records in employee table, for which, the department is not assigned. The output of the query should contain all the employees’ names and their corresponding departments, if the department is assigned otherwise employee names and null value in the place department name. What is the query?
What you want to use here is called a left outer join with Employee table on the left side. A left outer join as the name says picks up all the records from the left table and based on the joint column picks the matching records from the right table and in case there are no matching records in the right table, it shows null for the selected columns of the right table. eg in this query which uses the key-word LEFT OUTER JOIN. Syntax though varies across databases. In DB2/UDB it uses the key word LEFT OUTER JOIN, in case of Oracle the connector is Employee_table.Dept_id *= Dept_table.Dept_idSQL Server/Sybase : Employee_table.Dept_id(+) = Dept_table.Dept_id
17. What command is used to create a table by copying the structure of another table?
CREATE TABLE.. AS SELECT command
To copy only the structure, the WHERE clause of the SELECT command should contain a false statement as in the following.
CREATE TABLE NEWTABLE AS SELECT * FROM EXISTINGTABLE WHERE 1=2;
If the WHERE condition is true, then all the rows or rows satisfying the condition will be copied to the new table.
18. State True or False: !=, <>, ^= all denotes the same operation?
19. Which function is used to find the largest integer less than or equal to a specific value?
20. What does the following query do?
SELECT SAL + NVL (COMM, 0) FROM EMP;
This displays the total salary of all employees. The null values in the commission column will be replaced by 0 and added to salary.