Delete From Customer Where Id 1 Rollback
Delete From Customer Where Id 1 Rollback
5. When multiple columns are active collectively as the Primary Key, it is referred
to as
a) Primary Key
b) Composite Key
c) Alternate Key
d) Surrogate Key
6. What will be the output for following Command?
SELECT department_id, AVG(salary)
FROM employees
WHERE AVG(salary) > 8000
GROUP BY department_id;
a) Display department_id and average salary having average salary more than 8000.
b) Error as there should be salary in group by clause
c) Error as query must use join with aggregate functions
d) Error at line 3 as group function is not allowed here
7. If Select count(product_id) from order; gives 15 outputs then what will be the
number of outputs for following query:
Select count(distinct product_id) from order;
a) 15
b) <= 15
c) >15
d) 0
8. Which SQL keyword is used to combine the results of two or more SELECT
statements?
a) JOIN
b) UNION
c) MERGE
d) COMBINE
9. Which SQL JOIN type will return all records from the left table and matching
records from the right table?
a) INNER JOIN
b) LEFT JOIN
c) RIGHT JOIN
d) FULL JOIN
10. Which SQL keyword is used to retrieve data from a database table?
a) GET
b) EXTRACT
c) FETCH
d) SELECT
11. Which SQL statement is used to make permanent changes to the database?
a) COMMIT
b) SAVE
c) PERMANENT
d) ALTER
12. In SQL, which operator is used to check for matching values in a specified
list?
a) LIKE
b) BETWEEN
c) IN
d) MATCH
17. We can use literal in the CONCAT function. What does literal refer to?
a) Number
b) Character
c) Date
d) All of the above
19. Which of the following query find the total number of employees working on
‘HR’ departments?
20. Which of the following query finds the total rating of the sailors who have
reserved boat 103?
a) SELECT SUM(s.rating) FROM sailors s, reserves r AND r.bid = 103;
b) SELECT s.rating FROM sailors s, reserves r WHERE s.sid = r.sid AND r.bid = 103;
c) SELECT COUNT(s.rating) FROM sailors s, reserves r WHERE s.sid = r.sid AND r.bid
= 103;
d) SELECT SUM(s.rating) FROM sailors s, reserves r WHERE s.sid = r.sid AND r.bid =
103;