MCQPractice 93486
MCQPractice 93486
a) MySQL
b) Oracle
c) Microsoft Access
d) All of the above
2. What is the most common SQL statement used to retrieve data from a database?
a) CREATE
b) INSERT
c) SELECT
d) UPDATE
6. Which SQL keyword is used to combine the results of two or more SELECT statements?
a) JOIN
b) UNION
c) Merge
d) Combine
9. The WHERE clause filters data based on a specific condition. What operator is used for
comparisons?
a) =
b) +
c) *
d) ,
11. What is the difference between an INNER JOIN and an OUTER JOIN?
a) INNER JOIN returns all matching rows, while OUTER JOIN returns all rows from one table.
b) There is no difference.
c) INNER JOIN is used for dates, while OUTER JOIN is used for text data.
d) OUTER JOIN is faster than INNER JOIN.
22. What does the HAVING clause do in a SELECT statement used with GROUP BY?
a) Filters groups based on a condition applied to aggregate functions
b) Filters individual rows based on a condition
c) Sorts the grouped results
d) Limits the number of groups returned
23. What is the difference between UNION and UNION ALL operators in SQL?
a) UNION removes duplicates, while UNION ALL keeps all rows
b) There is no difference.
c) UNION is used for numeric data, while UNION ALL is used for text data.
d) UNION ALL is faster than UNION.
35. Table Employee has 10 records. It has a non-NULL SALARY column which is also
UNIQUE. What will be the output of the given SQL Statement: SELECT COUNT(*)
FROM employee WHERE SALARY > ANY (SELECT SALARY FROM EMPLOYEE);
a) 10
b) 1
c) 9
d) 0
36. The SQL Statement: SELECT SUBSTR ('abcabcabc', INSTR ('123321123', '3', 3, 2),
2) FROM DUAL;
a) ab
b) bc
c) ca
d) null
38. The SQL statement: SELECT ROUND (55.926, -1) FROM DUAL;
a) is illegal
b) prints 56
c) print 50
d) print 60
39. What is the difference between logical operators (AND, OR, NOT) and comparison
operators (=, <, >)?
a) Logical operators combine conditions, while comparison operators evaluate expressions.
b) There is no difference.
c) Logical operators are used for numeric data, while comparison operators are used for text data.
d) Comparison operators are faster than logical operators.
40. What is the purpose of functions in SQL?
a) To define the structure of a table
b) To perform calculations or manipulations on data
c) To create relationships between tables
d) To manage database users
41. What is the difference between aggregate functions (SUM, AVG, COUNT) and scalar
functions (UPPER, LOWER, LENGTH)?
a) Aggregate functions operate on groups of data, returning a single value, while scalar functions
operate on individual values.
b) There is no difference.
c) Aggregate functions are used for numeric data, while scalar functions are used for text data.
d) Scalar functions are faster than aggregate functions.
43. How to select all data from student table starting the name from letter 'r'?
a) SELECT * FROM student WHERE name LIKE 'r%';
b) SELECT * FROM student WHERE name LIKE '%r%';
c) SELECT * FROM student WHERE name LIKE '%r';
d) SELECT * FROM student WHERE name LIKE '_r%';
44. Which of the following SQL statements is used to retrieve data from a table named
"customers" and display all columns?
a) CREATE TABLE customers (id INT, name VARCHAR (255));
b) INSERT INTO customers (id, name) VALUES (1, "John Doe");
c) SELECT * FROM customers;
d) UPDATE customers SET name = "Jane Doe" WHERE id = 1;
45. How can you filter the results in the "customers" table to only show customers with an
ID greater than 10?
a) SELECT * FROM customers;
b) SELECT * FROM customers WHERE id > 10;
c) DELETE FROM customers WHERE id > 10;
d) GROUP BY id FROM customers;
46. What SQL statement would you use to display the number of customers in the
"customers" table?
a) SELECT COUNT (*) FROM customers;
b) SELECT id FROM customers;
c) UPDATE customers SET name = UPPER (name);
d) ORDER BY id ASC FROM customers;
47. How can you retrieve the names of all customers from the "customers" table, sorted
alphabetically (ascending order) by their names?
a) SELECT * FROM customers;
b) SELECT name FROM customers ORDER BY name;
c) SELECT name FROM customers WHERE name LIKE "%Doe%";
d) GROUP BY name FROM customers;